Module Text::Levenshtein
In: lib/text/levenshtein.rb

Methods

distance  

Public Instance methods

Calculate the Levenshtein distance between two strings +str1+ and +str2+.

The optional argument max_distance can reduce the number of iterations by stopping if the Levenshtein distance exceeds this value. This increases performance where it is only necessary to compare the distance with a reference value instead of calculating the exact distance.

The distance is calculated in terms of Unicode codepoints. Be aware that this algorithm does not perform normalisation: if there is a possibility of different normalised forms being used, normalisation should be performed beforehand.

[Validate]