Lingua::EN::SimilarNames::Levenshtein - Compare people first and last names.
my $people = [ [ 'John', 'Wayne' ], [ 'Sundance', 'Kid' ], [ 'Jose', 'Wales' ], [ 'John', 'Wall' ], ]; my @people_objects = map { Person->new( first_name => $_->[0], last_name => $_->[1], ) } @{$people}; # Build list of name pairs within 5 character edits of each other my $similar_people = SimilarNames->new( list_of_people => \@people_objects, maximum_distance => 5 ); # Get the people name pairs as an ArrayRef[ArrayRef[ArrayRef[Str]]] print Dumper $similar_people->list_of_similar_name_pairs; # which results in: [ [ [ "Jose", "Wales" ], [ "John", "Wall" ] ], [ [ "Jose", "Wales" ], [ "John", "Wayne" ] ], [ [ "John", "Wall" ], [ "John", "Wayne" ] ] ]
Given a list of people objects, find the people whose names are within a specified edit distance.
This class defines people objects with first and last name attributes.
This class defines comparator objects. Given two Person objects, it computes the edit distance between their names.
This class takes a list of Person objects and uses CompareTwoNames to generate a list of people with similar names based on an edit distance range.
One can get at the list of Person object pairs with similar name via the list_of_people_with_similar_names attribute. Alternatively, one can get at list of the names pairs themselves (no Person object) via the list_of_similar_name_pairs attribute.
list_of_people_with_similar_names
list_of_similar_name_pairs
This is called on a SimilarNames object to return a list of similar name pairs for the list of Person objects passed in. It uses the Levenshtein edit distance. This means the names are close to one another in spelling.
This accessor is similar to the list_of_similar_name_pairs but returns a list of Person object pairs instead of the names.
Mateu X. Hunter hunter@missoula.org
hunter@missoula.org
Copyright 2010, Mateu X. Hunter
You may distribute this code under the same terms as Perl itself.
http://github.com/mateu/Lingua-EN-SimilarNames-Levenshtein
To install Lingua::EN::SimilarNames::Levenshtein, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::EN::SimilarNames::Levenshtein
CPAN shell
perl -MCPAN -e shell install Lingua::EN::SimilarNames::Levenshtein
For more information on module installation, please visit the detailed CPAN module installation guide.