var dmp = new diff_match_patch(); var diffs = dmp.diff_main("709113544", "1555855732"); var distance = dmp.diff_levenshtein(diffs);
console.log(distance); // 14
Ha! That's awesome. I've had intermittent bugs surface due to this, but this is the first time I've been able to nail it down.
I need to generate a percentage of change between two strings, so my assumption that the maximum distance is the length of the longer string is clearly what caused the aforementioned bugs...
What would be the maximum distance? Is there any easy/consistent way to determine that?
> --
> You received this message because you are subscribed to a topic in the Google Groups "Diff Match Patch" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/diff-match-patch/RXxj5-fxMKs/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to diff-match-pat...@googlegroups.com.
> To post to this group, send email to diff-mat...@googlegroups.com.
> Visit this group at http://groups.google.com/group/diff-match-patch?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>