KevinStern / software-and-algorithms

Neat algorithm implementations in Java.
MIT License
118 stars 70 forks source link

DamerauLevenshteinAlgorithm Incorrect? #5

Closed ghost closed 10 years ago

ghost commented 10 years ago

Please check these two words "answer" and "sahen". There distance should be 5, but the output of your algorithm seems to be 4.

http://fuzzy-string.com/Compare/Transform.aspx?r=answer&q=sahen

KevinStern commented 10 years ago

string 1 = answer string 2 = sahen

swap a and s, deleting n from string 1, cost 2: sawer replace w with h, cost 1: saher match e with e, cost 0: saher replace r with n, cost 1: sahen

total cost is 4

Please read the caveat from the website to which you linked. It explains the difference between my implementation and theirs.

Regards,

Kevin

On Fri, Jun 13, 2014 at 12:09 AM, Kewei Ma notifications@github.com wrote:

Please check these two words "answer" and "sahen". There distance should be 5, but the output of your algorithm seems to be 4.

http://fuzzy-string.com/Compare/Transform.aspx?r=answer&q=sahen

— Reply to this email directly or view it on GitHub https://github.com/KevinStern/software-and-algorithms/issues/5.