NAME
Text::Levenshtein::Damerau - Damerau Levenshtein edit distance
SYNOPSIS
use Text::Levenshtein::Damerau;
use warnings;
use strict;
my @targets = ('fuor','xr','fourrrr','fo');
# Initialize Text::Levenshtein::Damerau object with text to compare against
my $tld = Text::Levenshtein::Damerau->new('four');
print $tld->dld($targets[0]);
# prints 1
my %tld_hash = $tld->dld(@targets);
print $tld_hash{'fuor'};
# prints 1
print $tld->dld_best_match(@targets);
# prints fuor
print $tld->dld_best_distance(@targets);
# prints 1
DESCRIPTION
Returns the true Damerau Levenshtein edit distance of strings with adjacent transpositions.
Methods
- new
-
Constructor. Takes a scalar with the text you want to compare against.
- dld
-
Takes a $source string as first argument and a scalar/list of strings for the second argument ($targets). Returns hash reference with a key for each $target and a value of their edit distance.
- dld_best_match
-
Takes a $source string as first argument and a scalar/list of strings for the second argument ($targets). Returns a scalar containing the text of the best match.
- dld_best_distance
-
Takes a $source string as first argument and a scalar/list of strings for the second argument ($targets). Returns the edit distance of the best match, aka $self->dld( $self->dld_best_match );
AUTHOR
ugexe <ug@skunkds.com>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.