File Coverage

blib/lib/Text/Names/GB.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Text::Names::GB;
2              
3 4     4   248665 use warnings;
  4         5  
  4         266  
4 4     4   36 use strict;
  4         8  
  4         222  
5              
6             # our @ISA = ('Text::Names');
7 4         1810 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   5806 /;
  4         147829  
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.04
77              
78             =cut
79              
80             our $VERSION = '0.04';
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 388433 my $name = uc(shift);
100              
101 27         209 my %gender_map = (
102             'BERTIE' => 'M',
103             'BARRIE' => 'M',
104             'KAI' => 'M',
105             'REECE' => 'M',
106             'RITCHIE' => 'M',
107             'OLLIE' => 'M',
108             'BEATON' => 'M',
109             'CALLUM' => 'M',
110             'STACEY' => 'F',
111             'ZARA' => 'F'
112             );
113              
114 27 100       108 return $gender_map{$name} if exists $gender_map{$name};
115              
116             # Fallback to guessGender if the name is not in the map
117             # return $self->SUPER::guessGender($name);
118 23         64 return Text::Names::guessGender($name);
119             }
120              
121             =head1 AUTHOR
122              
123             Nigel Horne, C<< >>
124              
125             =head1 BUGS
126              
127             I need to work out how to make ISA and Exporter play nicely with each other.
128              
129             =head1 SEE ALSO
130              
131             L
132              
133             =head1 SUPPORT
134              
135             You can find documentation for this module with the perldoc command.
136              
137             perldoc Text::Names::GB
138              
139             You can also look for information at:
140              
141             =over 4
142              
143             =item * RT: CPAN's request tracker
144              
145             L
146              
147             =item * Search CPAN
148              
149             L
150              
151             =back
152              
153             =head1 LICENSE AND COPYRIGHT
154              
155             Copyright 2017-2024 Nigel Horne.
156              
157             This program is released under the following licence: GPL2
158              
159             =cut
160              
161             1;