jcb_perl has asked for the wisdom of the Perl Monks concerning the following question:
IMHO, this should print "1" because there is only one substitution necessary to get from "history" to "hustory", but instead it returns "2". Interestingly enough, this works as expected:use Text::Levenshtein qw(fastdistance distance); print fastdistance("history","hustory"), "\n"; # prints "2"
Any idea what I am doing wrong? Or do I have the wrong notion about how Levenshtein distance actually works?? I also tried using distance, but then something seriously goes wrong:print fastdistance("gistory","history"), "\n"; # prints "1"
I am using ActivePerl on Windows 7. The input file is ANSI. I am thankful for all hints!print distance("gistory","history"), "\n"; # prints "1234561234561"
Cheers and thanks, Christian
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text::Levenshtein - trouble
by Corion (Patriarch) on Jul 11, 2012 at 14:51 UTC | |
by Anonymous Monk on Jul 11, 2012 at 15:48 UTC | |
|
Re: Text::Levenshtein - trouble
by Khen1950fx (Canon) on Jul 12, 2012 at 13:25 UTC |