-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
120 lines (81 loc) · 3.34 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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).