提交 6f0a69c5 编写于 作者: S schneems

fix bug in Levenshtein distance calculation

Bug was discovered and discussed in #18395.
上级 71fc7892
......@@ -7,11 +7,9 @@ def self.distance str1, str2
t = str2
n = s.length
m = t.length
max = n/2
return m if (0 == n)
return n if (0 == m)
return n if (n - m).abs > max
d = (0..m).to_a
x = nil
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册