NAME
Text::Fuzzy - match strings with errors
SYNOPSIS
use Text::Fuzzy;
my $tf = Text::Fuzzy->new ('boboon');
print "Distance is ", $tf->distance ('babboon'), "\n";
my @words = qw/the quick brown fox jumped over the lazy dog/;
my $nearest = $tf->nearest (\@words);
print "Nearest array entry is ", $words[$nearest], "\n";
DESCRIPTION
Edit-distance methods for single words and arrays.
METHODS
new
my $tf = Text::Fuzzy->new ('bibbety bobbety boo');
Create a new Text::Fuzzy object from the supplied word.
distance
my $dist = $tf->distance ($word);
Return the edit distance to $word
from the word used to create the object in "new".
nearest
my $index = $tf->nearest (\@words);
Return the index of the nearest element in the array to the argument.
max_distance
print "The max distance is ", $tf->max_distance (), "\n";
$tf->max_distance (3);
Set or get the maximum edit distance of $tf
.
AUTHOR
Ben Bullock, <bkb@cpan.org>
COPYRIGHT & LICENCE
This package and associated files are copyright (C) 2012 Ben Bullock.
You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.