Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Gem::Text#levenshtein_distance

levenshtein_distance(str1, str2)

This code is based directly on the Text gem implementation Returns a value representing the “cost” of transforming str1 into str2

See also #format_text #truncate_text #clean_text also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1