| 1 | package Text::Names::GB; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | # our @ISA = ('Text::Names'); | ||||||||||
| 7 | 4 | ▶ | use Text::Names qw/ | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | /; | |||||||||
| 32 | # guessGender | ||||||||||
| 33 | |||||||||||
| 34 | 4 | require Exporter; | |||||||||
| 35 | |||||||||||
| 36 | 4 | our @ISA = qw(Exporter); | |||||||||
| 37 | |||||||||||
| 38 | 4 | 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 | 4 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 67 | |||||||||||
| 68 | 4 | 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 | 4 | 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 | 27 | ▶ | sub guessGender { | ||||||||
|
Subroutine
guessGender: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 99 | 27 | my $name = uc(shift); | |||||||||
| 100 | |||||||||||
| 101 | 27 | 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 | ▶ | return $gender_map{$name} if exists $gender_map{$name}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 115 | |||||||||||
| 116 | # Fallback to guessGender if the name is not in the map | ||||||||||
| 117 | # return $self->SUPER::guessGender($name); | ||||||||||
| 118 | 23 | return Text::Names::guessGender($name); | |||||||||
| 119 | } | ||||||||||
| 120 | |||||||||||
| 121 | =head1 AUTHOR | ||||||||||
| 122 | |||||||||||
| 123 | Nigel Horne, C<< <njh at bandsman.co.uk> >> | ||||||||||
| 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<Text::Names> | ||||||||||
| 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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Names-GB> | ||||||||||
| 146 | |||||||||||
| 147 | =item * Search CPAN | ||||||||||
| 148 | |||||||||||
| 149 | L<http://search.cpan.org/dist/Text-Names-GB/> | ||||||||||
| 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 | 4 | 1; | |||||||||