Skip to content

Commit 0e7b9ec

Browse files
authored
Merge pull request #29 from adamko147/adamko147-ngram
fix ngram distance for strings shorter than N
2 parents 2efcfe7 + 060e137 commit 0e7b9ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strsimpy/ngram.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def distance(self, s0, s1):
4646
for i in range(min(sl, tl)):
4747
if s0[i] == s1[i]:
4848
cost += 1
49-
return 1.0 * cost / max(sl, tl)
49+
return 1.0 - cost / max(sl, tl)
5050

5151
sa = [''] * (sl + self.n - 1)
5252

0 commit comments

Comments
 (0)