Sol110 / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch
Apache License 2.0
0 stars 0 forks source link

Levenshtein maximum distance is greater than length of both strings #87

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
--------------------------------------
Compute the levenshtein distance between "709113544" and "1555855732":
var dmp = new diff_match_patch();
var diffs = dmp.diff_main("709113544", "1555855732");
var distance = dmp.diff_levenshtein(diffs);

--------------------------------------
What is the expected output? 
10 (that's the length of the bigger string)
What do you see instead?
14

--------------------------------------
What version of the product are you using? On what operating system?
Javascript version 20121119. Running in node.js, also reproduced in chrome: 
http://plnkr.co/Qgi9q4IyWmguK5mIAMxy

Original issue reported on code.google.com by andersly...@gmail.com on 22 May 2013 at 7:28

GoogleCodeExporter commented 9 years ago
I have the same probleme with this C# code :

            DiffMatchPatch.diff_match_patch dmpDiff = new DiffMatchPatch.diff_match_patch();
            List<DiffMatchPatch.Diff> lDiffs = dmpDiff.diff_main("considéré", "apprécié");
            int iIndex = dmpDiff.diff_levenshtein(lDiffs);
            Console.WriteLine(iIndex); // 11 ??????

According to the docs on the API home page  this is not possible. The length of 
the longer string is equal to 9.
"The minimum distance is 0 which means equality, the maximum distance is the 
length of the longer string."

Original comment by cnh...@gmail.com on 1 Oct 2013 at 10:47