I want to compute the edit distance between two strings, using 4 operations: character insertion, deletion, replacement and swapping. Each operation is associated with a cost. For instance, if the first three costs are equal to 10 and the last is equal to 1, we have:
distance(abc,bca) = 2 (swap a and b then swap a and c)
distance(abc,bae) = 11 (swap b and a then replace c by e)
distance(abcd,bdca) = 4
I read the Wikipedia article about Damerau-Levenshtein distance, but the algorithm they give works only if 2 × swapping cost ≥ insert cost + delete cost.