go ahead... be a heretic | |
PerlMonks |
Re: Edit distance between two stringsby AppleFritter (Vicar) |
on Jul 08, 2014 at 09:44 UTC ( [id://1092697]=note: print w/replies, xml ) | Need Help?? |
The standard metric for that is called the Levenshtein distance. A quick CPAN search suggests Text::Levenshtein or Text::Fuzzy. The latter also has the ability to show you what edits were made in which positions. Note that the Levenshtein distance allows for substitutions in addition to insertions and deletions. I'm not aware of a "standard" edit distance metric that only uses insertions and deletions, but you could fiddle with the weights in Text::WagnerFischer to rule out substitutions.
This prints:
Take your pick.
In Section
Seekers of Perl Wisdom
|
|