Watch this Author's files
In the transposition part, "d(i-2,j-2)" should be "d(i-1,j-1)", otherwise cumulative costs don't carry forward.
I get incorrect values for a swap with levenshtein-damerau:
14> edit_distance_damerau('smtih', 'smith')
ans = 0
ans should be 1, with the swapping of "ti"
Otherwise nice code -- I am using it to understand this algorithm