Lingua::EN::NameParse - routines for manipulating a persons name
use Lingua::EN::NameParse qw(clean case_surname); # optional configuration arguments my %args = ( salutation => 'Dear', sal_default => 'Friend', auto_clean => 1, force_case => 1, lc_prefix => 1, initials => 3, allow_reversed => 1 ); my $name = new Lingua::EN::NameParse(%args); $error = $name->parse("MR AC DE SILVA"); %name_comps = $name->components; $surname = $name_comps{surname_1}; # DE SILVA $correct_casing = $name->case_all; # Mr AC de Silva $good_name = &clean("Bad Na9me "); # "Bad Name" $name->salutation; # Dear Mr de Silva %my_properties = $name->properties; $number_surnames = $my_properties{number}; # 1 $bad_input = $my_properties{non_matching}; $lc_prefix = 0; $correct_case = &case_surname("DE SILVA-MACNAY",$lc_prefix); # De Silva-MacNay
This module takes as input a person or persons name in free format text such as,
Mr AB & M/s CD MacNay-Smith MR J.L. D'ANGELO Estate Of The Late Lieutenant Colonel AB Van Der Heiden
and attempts to parse it. If successful, the name is broken down into components and useful functions can be performed like :
- converting upper or lower case values to name case (Mr AB MacNay ) - creating a personalised greeting or salutation (Dear Mr MacNay ) - extracting the names individual components (Mr,AB,MacNay ) - determining the type of format the name is in (Mr_A_Smith )
If the name cannot be parsed you have the option of cleaning the name of bad characters, or extracting any portion that was parsed and the portion that failed.
This module can be used for analysing and improving the quality of lists of names.
Perl, version 5.001 or higher and Parse::RecDescent
perl Makefile.PL make make test make install
NameParse was written by Kim Ryan <kimaryan@ozemail.com.au>.
Copyright (c) 1999,2001 Kim Ryan. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html).
To install Lingua::EN::NameParse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::EN::NameParse
CPAN shell
perl -MCPAN -e shell install Lingua::EN::NameParse
For more information on module installation, please visit the detailed CPAN module installation guide.