matthieugomez / StringDistances.jl

String Distances in Julia
Other
134 stars 18 forks source link

The value of "compare" is probably wrong. #49

Closed C37H41N2O6 closed 3 years ago

C37H41N2O6 commented 3 years ago

I understand that to normalize the Levenshtein distance, the value is divided by the longer string length. However, the results I have calculated using that method are different from the results using the compare function.

julia> using StringDistances
julia> s1 = "martha"
julia> s2 = "marhtai"
julia> Levenshtein()(s1, s2)
3
julia> max(length(s1),length(s2))
7
julia> 1 - Levenshtein()(s1, s2) / 7
0.5714285714285714
julia> compare(s1, s2, Levenshtein())
0.8571428571428572

Why did this result occur? I would appreciate it if you could tell me about it.

matthieugomez commented 3 years ago

You switched marhtai to mahrtai in your issue