Escaping the Levenshtein hell

[the code, sample usage below] Edit distance is a problem I frequently encounter. It is just a number measuring how many rudimentary operations on characters (insertions, replacements and deletions) you need to transform one string of text into another. In this form it’s called the Levenshtein distance, or Levenshtein-Damerau if you add transpositions (making apple …