tad-lispy/node-damerau-levenshtein

Incorrect answer for specific strings

Opened this issue · 0 comments

Hello!
I have been trying to incorporate Damerau-Levenshtein distance into my project, and this library seems to be the best option for me. However, after some testing I found that it does not really count transpositions correctly.
Suppose I want to get the distance from CA to ABC. Clearly, the answer is 2: CA -> (transposition) AC -> (insert) ABC. But the package says it was 3 steps: { steps: 3, relative: 1, similarity: 0 }
The code to reproduce:

import levenshtein from 'damerau-levenshtein';
const lev = levenshtein('CA', 'ABC');
console.log(lev);

Feel free to correct me, but seems like this is clearly an incorrect answer. I am not exactly sure what the issue is and how to fix, so I would want some assistance here.