Pārlūkot izejas kodu

Bug fix

If one string is empty, the edit-distance is the length of the other
Uri Goren 6 gadi atpakaļ
vecāks
revīzija
5f6717fe6d
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  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)