| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Text::Names::GB; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
110647
|
use warnings; |
|
|
4
|
|
|
|
|
29
|
|
|
|
4
|
|
|
|
|
125
|
|
|
4
|
4
|
|
|
4
|
|
17
|
use strict; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
145
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# our @ISA = ('Text::Names'); |
|
7
|
4
|
|
|
|
|
1540
|
use Text::Names qw/ |
|
8
|
|
|
|
|
|
|
abbreviationOf |
|
9
|
|
|
|
|
|
|
reverseName |
|
10
|
|
|
|
|
|
|
cleanParseName |
|
11
|
|
|
|
|
|
|
parseName |
|
12
|
|
|
|
|
|
|
parseName2 |
|
13
|
|
|
|
|
|
|
normalizeNameWhitespace |
|
14
|
|
|
|
|
|
|
samePerson |
|
15
|
|
|
|
|
|
|
sameAuthors |
|
16
|
|
|
|
|
|
|
parseNames |
|
17
|
|
|
|
|
|
|
parseNameList |
|
18
|
|
|
|
|
|
|
cleanNames |
|
19
|
|
|
|
|
|
|
cleanName |
|
20
|
|
|
|
|
|
|
weakenings |
|
21
|
|
|
|
|
|
|
composeName |
|
22
|
|
|
|
|
|
|
abbreviationOf |
|
23
|
|
|
|
|
|
|
setNameAbbreviations |
|
24
|
|
|
|
|
|
|
getNameAbbreviations |
|
25
|
|
|
|
|
|
|
isCommonSurname |
|
26
|
|
|
|
|
|
|
isCommonFirstname |
|
27
|
|
|
|
|
|
|
firstnamePrevalence |
|
28
|
|
|
|
|
|
|
surnamePrevalence |
|
29
|
|
|
|
|
|
|
isMisparsed |
|
30
|
|
|
|
|
|
|
isLikelyMisparsed |
|
31
|
4
|
|
|
4
|
|
4529
|
/; |
|
|
4
|
|
|
|
|
169154
|
|
|
32
|
|
|
|
|
|
|
# guessGender |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
require Exporter; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
|
39
|
|
|
|
|
|
|
@NAME_PREFIXES |
|
40
|
|
|
|
|
|
|
abbreviationOf |
|
41
|
|
|
|
|
|
|
reverseName |
|
42
|
|
|
|
|
|
|
cleanParseName |
|
43
|
|
|
|
|
|
|
parseName |
|
44
|
|
|
|
|
|
|
parseName2 |
|
45
|
|
|
|
|
|
|
normalizeNameWhitespace |
|
46
|
|
|
|
|
|
|
samePerson |
|
47
|
|
|
|
|
|
|
sameAuthors |
|
48
|
|
|
|
|
|
|
parseNames |
|
49
|
|
|
|
|
|
|
parseNameList |
|
50
|
|
|
|
|
|
|
cleanNames |
|
51
|
|
|
|
|
|
|
cleanName |
|
52
|
|
|
|
|
|
|
weakenings |
|
53
|
|
|
|
|
|
|
composeName |
|
54
|
|
|
|
|
|
|
abbreviationOf |
|
55
|
|
|
|
|
|
|
setNameAbbreviations |
|
56
|
|
|
|
|
|
|
getNameAbbreviations |
|
57
|
|
|
|
|
|
|
isCommonSurname |
|
58
|
|
|
|
|
|
|
isCommonFirstname |
|
59
|
|
|
|
|
|
|
guessGender |
|
60
|
|
|
|
|
|
|
firstnamePrevalence |
|
61
|
|
|
|
|
|
|
surnamePrevalence |
|
62
|
|
|
|
|
|
|
isMisparsed |
|
63
|
|
|
|
|
|
|
isLikelyMisparsed |
|
64
|
|
|
|
|
|
|
) ] ); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
our @EXPORT = (); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Text::Names::GB - Perl extension for proper name parsing, normalization, recognition, and classification |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Version 0.03 |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The documentation for Text::Names doesn't make this clear, that module is specific to the US. |
|
85
|
|
|
|
|
|
|
This module fixes that for the UK. |
|
86
|
|
|
|
|
|
|
Unfortunately because of the nature of Text::Names other countries will also have |
|
87
|
|
|
|
|
|
|
to be implemented as subclasses. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 guessGender |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Overrides the US tests with UK tests, |
|
94
|
|
|
|
|
|
|
that's probably true in most other countries as well. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub guessGender { |
|
99
|
27
|
|
|
27
|
1
|
73436
|
my $name = uc(shift); |
|
100
|
|
|
|
|
|
|
|
|
101
|
27
|
100
|
|
|
|
68
|
if($name eq 'BERTIE') { |
|
102
|
1
|
|
|
|
|
6
|
return 'M'; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
26
|
100
|
|
|
|
45
|
if($name eq 'BARRIE') { |
|
105
|
1
|
|
|
|
|
4
|
return 'M'; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
25
|
100
|
|
|
|
45
|
if($name eq 'KAI') { |
|
108
|
1
|
|
|
|
|
14
|
return 'M'; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
24
|
100
|
|
|
|
41
|
if($name eq 'REECE') { |
|
111
|
1
|
|
|
|
|
5
|
return 'M'; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
23
|
50
|
|
|
|
44
|
if($name eq 'RITCHIE') { |
|
114
|
0
|
|
|
|
|
0
|
return 'M'; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
23
|
50
|
|
|
|
36
|
if($name eq 'OLLIE') { |
|
117
|
0
|
|
|
|
|
0
|
return 'M'; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
23
|
50
|
|
|
|
45
|
if($name eq 'BEATON') { |
|
120
|
0
|
|
|
|
|
0
|
return 'M'; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
23
|
50
|
|
|
|
32
|
if($name eq 'CALLUM') { |
|
123
|
0
|
|
|
|
|
0
|
return 'M'; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
23
|
50
|
|
|
|
41
|
if($name eq 'STACEY') { |
|
126
|
0
|
|
|
|
|
0
|
return 'F'; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
23
|
50
|
|
|
|
40
|
if($name eq 'ZARA') { |
|
129
|
0
|
|
|
|
|
0
|
return 'F'; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
# return $self->SUPER::guessGender($name); |
|
132
|
23
|
|
|
|
|
51
|
return Text::Names::guessGender($name); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHOR |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Nigel Horne, C<< >> |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 BUGS |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
I need to work out how to make ISA and Exporter play nicely with each other. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 SUPPORT |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
perldoc Text::Names::GB |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
You can also look for information at: |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over 4 |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * Search CPAN |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
L |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=back |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Copyright 2017-2019 Nigel Horne. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
This program is released under the following licence: GPL2 |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1; |