teaching machines

Levenshtein distance

December 12, 2011 by . Filed under public, reader animated.

We’re looking at methods for comparing the distance between two sequences of text. A fairly simple one is Levenshtein distance, which calculates how many edits it takes to go from one string to another. I wrote a little calculator to demonstrate its results. Enter two words and calculate their distance. Cell (i, j) reports the minimum number of edits it takes to go from the first j characters of the starting word to the first i characters of the ending word. The bottom right, then, is the overall distance. Hover over each cell to see how the distance is calculated.