| 1 |
NAME |
| 2 |
|
| 3 |
Lingua::EN::NameParse - extract the components of a person or couples full name, from free form text |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
|
| 7 |
use Lingua::EN::NameParse qw(clean case_surname); |
| 8 |
|
| 9 |
# optional configuration arguments |
| 10 |
my %args = |
| 11 |
( |
| 12 |
auto_clean => 1, |
| 13 |
lc_prefix => 1, |
| 14 |
initials => 3, |
| 15 |
allow_reversed => 1, |
| 16 |
joint_names => 0, |
| 17 |
extended_titles => 0 |
| 18 |
); |
| 19 |
|
| 20 |
my $name = Lingua::EN::NameParse->new(%args); |
| 21 |
|
| 22 |
$error = $name->parse("Estate Of Lt Col AB Van Der Heiden (Hold Mail)"); |
| 23 |
unless ( $error ) |
| 24 |
{ |
| 25 |
print($name->report); |
| 26 |
|
| 27 |
Case all : Estate Of Lt Col AB Van Der Heiden (Hold Mail) |
| 28 |
Case all reversed : Van Der Heiden, Lt Col AB |
| 29 |
Salutation : Dear Friend |
| 30 |
Type : Mr_A_Smith |
| 31 |
Parsing Error : 0 |
| 32 |
Error description : : |
| 33 |
Parsing Warning : 1 |
| 34 |
Warning description : ;non_matching text found : (Hold Mail) |
| 35 |
|
| 36 |
COMPONENTS |
| 37 |
initials_1 : AB |
| 38 |
non_matching : (Hold Mail) |
| 39 |
precursor : Estate Of |
| 40 |
surname_1 : Van Der Heiden |
| 41 |
title_1 : Lt Col |
| 42 |
|
| 43 |
%name_comps = $name->components; |
| 44 |
$surname = $name_comps{surname_1}; |
| 45 |
|
| 46 |
$correct_casing = $name->case_all; |
| 47 |
|
| 48 |
$correct_casing = $name->case_all_reversed ; |
| 49 |
|
| 50 |
$salutation = $name->salutation(salutation => 'Dear',sal_default => 'Friend')); |
| 51 |
|
| 52 |
$good_name = clean("Bad Na9me "); # "Bad Name" |
| 53 |
|
| 54 |
%my_properties = $name->properties; |
| 55 |
$number_surnames = $my_properties{number}; # 1 |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
$lc_prefix = 0; |
| 60 |
$correct_case = case_surname("DE SILVA-MACNAY",$lc_prefix); # A stand alone function, returns: De Silva-MacNay |
| 61 |
|
| 62 |
$error = $name->parse("MR AS & D.E. DE LA MARE"); |
| 63 |
%my_properties = $name->properties; |
| 64 |
$number_surnames = $my_properties{number}; # 2 |
| 65 |
|
| 66 |
|
| 67 |
DESCRIPTION |
| 68 |
|
| 69 |
|
| 70 |
This module takes as input one person's name or a couples names in |
| 71 |
free format text such as, |
| 72 |
|
| 73 |
Mr AB & M/s CD MacNay-Smith |
| 74 |
MR J.L. D'ANGELO |
| 75 |
Estate Of The Late Lieutenant Colonel AB Van Der Heiden |
| 76 |
|
| 77 |
and attempts to parse it. If successful, the name is broken |
| 78 |
down into components and useful functions can be performed such as : |
| 79 |
|
| 80 |
converting upper or lower case values to name case (Mr AB MacNay ) |
| 81 |
creating a personalised greeting or salutation (Dear Mr MacNay ) |
| 82 |
extracting the names individual components (Mr,AB,MacNay ) |
| 83 |
determining the type of format the name is in (Mr_A_Smith ) |
| 84 |
|
| 85 |
|
| 86 |
If the name(s) cannot be parsed you have the option of cleaning the name(s) |
| 87 |
of bad characters, or extracting any portion that was parsed and the |
| 88 |
portion that failed. |
| 89 |
|
| 90 |
This module can be used for analysing and improving the quality of |
| 91 |
lists of names. |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
HOW TO INSTALL |
| 96 |
|
| 97 |
perl Makefile.PL |
| 98 |
make |
| 99 |
make test |
| 100 |
make install |
| 101 |
|
| 102 |
or |
| 103 |
|
| 104 |
perl Build.PL |
| 105 |
build |
| 106 |
build test |
| 107 |
build install |
| 108 |
|
| 109 |
|
| 110 |
AUTHOR |
| 111 |
|
| 112 |
NameParse was written by Kim Ryan, kimryan at cpan dot org |
| 113 |
|
| 114 |
COPYRIGHT AND LICENSE |
| 115 |
|
| 116 |
Copyright (c) 2016 Kim Ryan. All rights reserved. |
| 117 |
This program is free software; you can redistribute it |
| 118 |
and/or modify it under the terms of the Perl Artistic License |
| 119 |
(see http://www.perl.com/perl/misc/Artistic.html). |
| 120 |
|