This is a project that measures the edit-distance (a.k.a Levenshtein Distance) between two words. Click on the input box at the bottom to enter (or paste) a word, and press enter to submit. The distance between the two words is displayed for 5 seconds. A description of edit distance is provided below. Given a word, you can add, remove or substitute letters to morph it into another word. The minimum amount of times you have to substitute/remove/add letters is the Levenshtein distance between the two words. If the two words are the same, then the distance is 0. Here is an example, with "cap" and "catch" Change #1 - Insert letter "t" into "cap" to make "catp" Change #2 - Insert letter "c" into "catp" to make "catcp" Change #3 - Replace letter "p" in "catcp" with "h" to make "catch" Thus the Levenshtein distance between the two words is 3, as you can't morph "cap" to "catch" in any shorter way. Here's another example: "abc" => "defgh" The Levenshtein distance here is 5. The Levenshtein distance cannot be greater than the length of the longer of the two words. That is, "abc" is 3 letters, and "defgh" is 5, and so MAX(3, 5) is the upper limit for the Levenshtein distance. It could be less. Change #1: "abc" => replace "a" with "d" => "dbc" Change #2 "dbc" => replace "b" with "e" => "dec" Change #3 "dec" => replace "c" with "f" => "def" Change #4 "def" => add "g" => "defg" Change "defg" => add "h" => "defgh" If you reverse the steps, you can see that the LEVENSHTEIN_DISTANCE(A to B) = LEVENCHTEIN_DISTANCE(B to A).
I used the algorithm from Wikipedia, https://en.wikipedia.org/wiki/Levenshtein_distance, (the one that says "extremely inefficient"). This means that the algorithm is CC-BY-SA 3.0 and I attribute the Wikipedia article above.