Problem 2309. Calculate the Damerau-Levenshtein distance between two strings.
Solution Stats
Problem Comments
-
4 Comments
i am facing a problem with ur test suite 5. is it correct?
even the built-in matlab function 'edit distance' is giving the result 3.
which i believe is the correct one.
if i am not wrong, according to demarau algorithm - here transposition will not occur.
Test case #5 is correct, Asif. If you want, you can try it on wolfram alpha using DamerauLevenshteinDistance['abc','ca']. Be careful, because the algorithm from wikipedia has errors.
Another example that should return 2 via Damerou-Levenshtein and 3 via Levenshtein alone: 'jellyfish' and 'jellyifhs'.
The algorithm given by Wikipedia is correct, I think, but take note that the first algorithm Wikipedia gives does not actually compute the Damerau-Levenshtein distance, but rather a related metric. Confusing, but the entry says as much if you read it closely.
Solution Comments
Show commentsProblem Recent Solvers24
Suggested Problems
-
Find the two most distant points
2536 Solvers
-
Numbers with prime factors 2, 3 and 5.
428 Solvers
-
Concatenate string with cell array of strings
41 Solvers
-
3626 Solvers
-
Mersenne Primes vs. All Primes
528 Solvers
More from this Author40
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!