-
Notifications
You must be signed in to change notification settings - Fork 2
Extract the components of a person or couples full name, from free form text
License
kimryan/HumanNameParser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
NAME Lingua::EN::NameParse - extract the components of a person or couples full name, from free form text SYNOPSIS use Lingua::EN::NameParse qw(clean case_surname); # optional configuration arguments my %args = ( auto_clean => 1, lc_prefix => 1, initials => 3, allow_reversed => 1, joint_names => 0, extended_titles => 0 ); my $name = Lingua::EN::NameParse->new(%args); $error = $name->parse("Estate Of Lt Col AB Van Der Heiden (Hold Mail)"); unless ( $error ) { print($name->report); Case all : Estate Of Lt Col AB Van Der Heiden (Hold Mail) Case all reversed : Van Der Heiden, Lt Col AB Salutation : Dear Friend Type : Mr_A_Smith Parsing Error : 0 Error description : : Parsing Warning : 1 Warning description : ;non_matching text found : (Hold Mail) COMPONENTS initials_1 : AB non_matching : (Hold Mail) precursor : Estate Of surname_1 : Van Der Heiden title_1 : Lt Col %name_comps = $name->components; $surname = $name_comps{surname_1}; $correct_casing = $name->case_all; $correct_casing = $name->case_all_reversed ; $salutation = $name->salutation(salutation => 'Dear',sal_default => 'Friend')); $good_name = clean("Bad Na9me "); # "Bad Name" %my_properties = $name->properties; $number_surnames = $my_properties{number}; # 1 } $lc_prefix = 0; $correct_case = case_surname("DE SILVA-MACNAY",$lc_prefix); # A stand alone function, returns: De Silva-MacNay $error = $name->parse("MR AS & D.E. DE LA MARE"); %my_properties = $name->properties; $number_surnames = $my_properties{number}; # 2 DESCRIPTION This module takes as input one person's name or a couples names 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 such as : 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(s) cannot be parsed you have the option of cleaning the name(s) 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. HOW TO INSTALL perl Makefile.PL make make test make install or perl Build.PL build build test build install AUTHOR NameParse was written by Kim Ryan, kimryan at cpan dot org COPYRIGHT AND LICENSE Copyright (c) 2016 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).
About
Extract the components of a person or couples full name, from free form text
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published