Skip to content

TrueDamerauLevenshtein giving wrong results #3

@stapelberg

Description

@stapelberg

I noticed that these 2 Go libraries differ in results for the same input:

(stringdist.TrueDamerauLevenshtein).Calculate(4XHYWD, YLKTW9) = 6

tdl.Distance(4XHYWD, YLKTW9) = 5

Looking at the Perl implementation Text::Levenshtein::Damerau, both implementations (pure perl and XS) return 5:

% perl -MText::Levenshtein::Damerau -E 'say Text::Levenshtein::Damerau::edistance("4XHYWD", "YLKTW9")'
5

…hence, I think the issue lies within your implementation. Could you take a look please?

PS: the edge case where s == t does not return 0 in your implementation either. Not sure if it’s the same bug or a separate issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions