link levensht
August 25, 2010; Jeremy N. Cowgar
This file is in the public domain.
The procedure levenshtein(s1, s2) returns the minimum number of edit operations needed to transform string s1 into s2. Examples: levenshtein("day", "may") produces 1 levenshtein("cat", "dog") produces 3 Now, those are easy examples, but consider: levenshtein("Saturday", "Sunday") produces 3 Yes, 3. Delete "a" and "t" from Saturday (Surday), then change the "r" to an "n", and you have Sunday!