Browse Source

Bug fix

If one string is empty, the edit-distance is the length of the other
Uri Goren 6 năm trước cách đây
mục cha
commit
5f6717fe6d
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      strsimpy/levenshtein.py

+ 1 - 1
strsimpy/levenshtein.py

@@ -33,7 +33,7 @@ class Levenshtein(MetricStringDistance):
         if len(s0) == 0:
             return len(s1)
         if len(s1) == 0:
-            return len(s1)
+            return len(s0)
 
         v0 = [0] * (len(s1) + 1)
         v1 = [0] * (len(s1) + 1)