I was just talking about using cpanm to install from github. The latest cpanm also makes it easy to install a developer release. Coincidentally, Ben Bullock just mentioned the developer release of Text::Fuzzy. Let's try it!
$ cpanm --dev Text::Fuzzy --> Working on Text::Fuzzy Fetching http://www.cpan.org/authors/id/B/BK/BKB/Text-Fuzzy-0.10_01.tar.gz ... OK Configuring Text-Fuzzy-0.10_01 ... OK Building and testing Text-Fuzzy-0.10_01 ... OK Successfully installed Text-Fuzzy-0.10_01 1 distribution installed
Nice!
Also coincidentally, we were discussing Levenshtein versus Damerau-Levenshtein edit distances just the other day. In particular, it was noted that altitude and latitude were just one transposition away.
#!/usr/bin/env perl use v5.16; use warnings; use Text::Fuzzy; my $tf = Text::Fuzzy->new("latitude"); say "Levenshtein edit distance is ", $tf->distance("altitude"); $tf->transpositions_ok(1); say "Damerau-Levenshtein edit distance is ", $tf->distance("altitude");
Lo and behold, the new Text::Fuzzy tells us that!
$ ./fuzzy.pl Levenshtein edit distance is 2 Damerau-Levenshtein edit distance is 1
Recent Comments