Преглед изворни кода

Bug fix

If one string is empty, the edit-distance is the length of the other
Uri Goren пре 6 година
родитељ
комит
5f6717fe6d
1 измењених фајлова са 1 додато и 1 уклоњено
  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)