@@ -49,15 +49,15 @@ public class JaroWinkler : INormalizedStringSimilarity, INormalizedStringDistanc
4949 /// The current value of the threshold used for adding the Winkler bonus. The default value is 0.7.
5050 /// </summary>
5151 private double Threshold { get ; }
52-
52+
5353 /// <summary>
5454 /// Creates a new instance with default threshold (0.7)
5555 /// </summary>
5656 public JaroWinkler ( )
5757 {
5858 Threshold = DEFAULT_THRESHOLD ;
5959 }
60-
60+
6161 /// <summary>
6262 /// Creates a new instance with given threshold to determine when Winkler bonus should
6363 /// be used. Set threshold to a negative value to get the Jaro distance.
@@ -77,20 +77,10 @@ public JaroWinkler(double threshold)
7777 /// <exception cref="ArgumentNullException">If s1 or s2 is null.</exception>
7878 public double Similarity ( string s1 , string s2 )
7979 => Similarity ( s1 . AsSpan ( ) , s2 . AsSpan ( ) ) ;
80-
80+
8181 public double Similarity < T > ( ReadOnlySpan < T > s1 , ReadOnlySpan < T > s2 )
8282 where T : IEquatable < T >
8383 {
84- if ( s1 == null )
85- {
86- throw new ArgumentNullException ( nameof ( s1 ) ) ;
87- }
88-
89- if ( s2 == null )
90- {
91- throw new ArgumentNullException ( nameof ( s2 ) ) ;
92- }
93-
9484 if ( s1 . SequenceEqual ( s2 ) )
9585 {
9686 return 1f ;
@@ -122,7 +112,7 @@ public double Similarity<T>(ReadOnlySpan<T> s1, ReadOnlySpan<T> s2)
122112 /// <exception cref="ArgumentNullException">If s1 or s2 is null.</exception>
123113 public double Distance ( string s1 , string s2 )
124114 => 1.0 - Similarity ( s1 , s2 ) ;
125-
115+
126116 public double Distance < T > ( ReadOnlySpan < T > s1 , ReadOnlySpan < T > s2 )
127117 where T : IEquatable < T >
128118 => 1.0 - Similarity ( s1 , s2 ) ;
@@ -202,7 +192,7 @@ private static int[] Matches<T>(ReadOnlySpan<T> s1, ReadOnlySpan<T> s2)
202192 break ;
203193 }
204194 }
205- return new [ ] { matches , transpositions / 2 , prefix , max . Length } ;
195+ return [ matches , transpositions / 2 , prefix , max . Length ] ;
206196 }
207197 }
208198}
0 commit comments