← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:12 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Lingua/EN/Inflect.pm
StatementsExecuted 119135 statements in 673ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
75807631341ms341msLingua::EN::Inflect::::CORE:matchLingua::EN::Inflect::CORE:match (opcode)
117911172ms511msLingua::EN::Inflect::::_PL_nounLingua::EN::Inflect::_PL_noun
12201169.5ms98.4msLingua::EN::Inflect::::_PL_special_verbLingua::EN::Inflect::_PL_special_verb
3419232134.1ms34.1msLingua::EN::Inflect::::CORE:regcompLingua::EN::Inflect::CORE:regcomp (opcode)
12201121.0ms30.3msLingua::EN::Inflect::::_PL_special_adjectiveLingua::EN::Inflect::_PL_special_adjective
12201118.7ms675msLingua::EN::Inflect::::PLLingua::EN::Inflect::PL
12201110.8ms13.0msLingua::EN::Inflect::::postprocessLingua::EN::Inflect::postprocess
3619316.66ms6.66msLingua::EN::Inflect::::ud_matchLingua::EN::Inflect::ud_match
1111.41ms9.79msLingua::EN::Inflect::::BEGIN@5Lingua::EN::Inflect::BEGIN@5
123331590┬Ás590┬ÁsLingua::EN::Inflect::::CORE:substLingua::EN::Inflect::CORE:subst (opcode)
4946159┬Ás59┬ÁsLingua::EN::Inflect::::encloseLingua::EN::Inflect::enclose
11111┬Ás22┬ÁsLingua::EN::Inflect::::BEGIN@3Lingua::EN::Inflect::BEGIN@3
11110┬Ás10┬ÁsLingua::EN::Inflect::::CORE:sortLingua::EN::Inflect::CORE:sort (opcode)
1117┬Ás55┬ÁsLingua::EN::Inflect::::BEGIN@4Lingua::EN::Inflect::BEGIN@4
1116┬Ás6┬ÁsLingua::EN::Inflect::::CORE:ftereadLingua::EN::Inflect::CORE:fteread (opcode)
1112┬Ás2┬ÁsLingua::EN::Inflect::::CORE:qrLingua::EN::Inflect::CORE:qr (opcode)
0000s0sLingua::EN::Inflect::::ALingua::EN::Inflect::A
0000s0sLingua::EN::Inflect::::ANLingua::EN::Inflect::AN
0000s0sLingua::EN::Inflect::::NOLingua::EN::Inflect::NO
0000s0sLingua::EN::Inflect::::NUMLingua::EN::Inflect::NUM
0000s0sLingua::EN::Inflect::::NUMWORDSLingua::EN::Inflect::NUMWORDS
0000s0sLingua::EN::Inflect::::ORDLingua::EN::Inflect::ORD
0000s0sLingua::EN::Inflect::::PART_PRESLingua::EN::Inflect::PART_PRES
0000s0sLingua::EN::Inflect::::PL_ADJLingua::EN::Inflect::PL_ADJ
0000s0sLingua::EN::Inflect::::PL_ADJ_eqLingua::EN::Inflect::PL_ADJ_eq
0000s0sLingua::EN::Inflect::::PL_NLingua::EN::Inflect::PL_N
0000s0sLingua::EN::Inflect::::PL_N_eqLingua::EN::Inflect::PL_N_eq
0000s0sLingua::EN::Inflect::::PL_VLingua::EN::Inflect::PL_V
0000s0sLingua::EN::Inflect::::PL_V_eqLingua::EN::Inflect::PL_V_eq
0000s0sLingua::EN::Inflect::::PL_eqLingua::EN::Inflect::PL_eq
0000s0sLingua::EN::Inflect::::WORDLISTLingua::EN::Inflect::WORDLIST
0000s0sLingua::EN::Inflect::::_PL_check_plurals_ADJLingua::EN::Inflect::_PL_check_plurals_ADJ
0000s0sLingua::EN::Inflect::::_PL_check_plurals_NLingua::EN::Inflect::_PL_check_plurals_N
0000s0sLingua::EN::Inflect::::_PL_eqLingua::EN::Inflect::_PL_eq
0000s0sLingua::EN::Inflect::::_PL_general_verbLingua::EN::Inflect::_PL_general_verb
0000s0sLingua::EN::Inflect::::_PL_reg_pluralsLingua::EN::Inflect::_PL_reg_plurals
0000s0sLingua::EN::Inflect::::__ANON__[:773]Lingua::EN::Inflect::__ANON__[:773]
0000s0sLingua::EN::Inflect::::__ANON__[:785]Lingua::EN::Inflect::__ANON__[:785]
0000s0sLingua::EN::Inflect::::__ANON__[:846]Lingua::EN::Inflect::__ANON__[:846]
0000s0sLingua::EN::Inflect::::_commifyLingua::EN::Inflect::_commify
0000s0sLingua::EN::Inflect::::_indef_articleLingua::EN::Inflect::_indef_article
0000s0sLingua::EN::Inflect::::checkpatLingua::EN::Inflect::checkpat
0000s0sLingua::EN::Inflect::::checkpatsubsLingua::EN::Inflect::checkpatsubs
0000s0sLingua::EN::Inflect::::classicalLingua::EN::Inflect::classical
0000s0sLingua::EN::Inflect::::def_aLingua::EN::Inflect::def_a
0000s0sLingua::EN::Inflect::::def_adjLingua::EN::Inflect::def_adj
0000s0sLingua::EN::Inflect::::def_anLingua::EN::Inflect::def_an
0000s0sLingua::EN::Inflect::::def_nounLingua::EN::Inflect::def_noun
0000s0sLingua::EN::Inflect::::def_verbLingua::EN::Inflect::def_verb
0000s0sLingua::EN::Inflect::::enwordLingua::EN::Inflect::enword
0000s0sLingua::EN::Inflect::::hundLingua::EN::Inflect::hund
0000s0sLingua::EN::Inflect::::inflectLingua::EN::Inflect::inflect
0000s0sLingua::EN::Inflect::::millLingua::EN::Inflect::mill
0000s0sLingua::EN::Inflect::::tenLingua::EN::Inflect::ten
0000s0sLingua::EN::Inflect::::unitLingua::EN::Inflect::unit
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Lingua::EN::Inflect;
2
3222┬Ás233┬Ás
# spent 22┬Ás (11+11) within Lingua::EN::Inflect::BEGIN@3 which was called: # once (11┬Ás+11┬Ás) by Pod::Wordlist::BEGIN@4 at line 3
use strict;
# spent 22┬Ás making 1 call to Lingua::EN::Inflect::BEGIN@3 # spent 11┬Ás making 1 call to strict::import
4218┬Ás2103┬Ás
# spent 55┬Ás (7+48) within Lingua::EN::Inflect::BEGIN@4 which was called: # once (7┬Ás+48┬Ás) by Pod::Wordlist::BEGIN@4 at line 4
use vars qw($VERSION @EXPORT_OK %EXPORT_TAGS @ISA);
# spent 55┬Ás making 1 call to Lingua::EN::Inflect::BEGIN@4 # spent 48┬Ás making 1 call to vars::import
529.17ms216.7ms
# spent 9.79ms (1.41+8.38) within Lingua::EN::Inflect::BEGIN@5 which was called: # once (1.41ms+8.38ms) by Pod::Wordlist::BEGIN@4 at line 5
use Env;
# spent 9.79ms making 1 call to Lingua::EN::Inflect::BEGIN@5 # spent 6.93ms making 1 call to Env::import
6
711┬Ásrequire Exporter;
817┬Ás@ISA = qw(Exporter);
9
101400nsour $VERSION = '1.895';
11
12112┬Ás%EXPORT_TAGS =
13(
14 ALL => [ qw( classical inflect
15 PL PL_N PL_V PL_ADJ NO NUM A AN
16 PL_eq PL_N_eq PL_V_eq PL_ADJ_eq
17 PART_PRES
18 ORD
19 NUMWORDS
20 WORDLIST
21 def_noun def_verb def_adj def_a def_an )],
22
23 INFLECTIONS => [ qw( classical inflect
24 PL PL_N PL_V PL_ADJ PL_eq
25 NO NUM A AN PART_PRES )],
26
27 PLURALS => [ qw( classical inflect
28 PL PL_N PL_V PL_ADJ NO NUM
29 PL_eq PL_N_eq PL_V_eq PL_ADJ_eq )],
30
31 COMPARISONS => [ qw( classical
32 PL_eq PL_N_eq PL_V_eq PL_ADJ_eq )],
33
34 ARTICLES => [ qw( classical inflect NUM A AN )],
35
36 NUMERICAL => [ qw( ORD NUMWORDS )],
37
38 USER_DEFINED => [ qw( def_noun def_verb def_adj def_a def_an )],
39);
40
4113┬Ás124┬ÁsExporter::export_ok_tags(qw( ALL ));
# spent 24┬Ás making 1 call to Exporter::export_ok_tags
42
43# SUPPORT CLASSICAL PLURALIZATIONS
44
4511┬Ásmy %def_classical = (
46 all => 0,
47 zero => 0,
48 herd => 0,
49 names => 1,
50 persons => 0,
51 ancient => 0,
52);
53
541800nsmy %all_classical = (
55 all => 1,
56 zero => 1,
57 herd => 1,
58 names => 1,
59 persons => 1,
60 ancient => 1,
61);
62
6312┬Ásmy %classical = %def_classical;
64
6512┬Ásmy $classical_mode = join '|', keys %all_classical;
66129┬Ás220┬Ás $classical_mode = qr/^(?:$classical_mode)$/;
# spent 18┬Ás making 1 call to Lingua::EN::Inflect::CORE:regcomp # spent 2┬Ás making 1 call to Lingua::EN::Inflect::CORE:qr
67
68sub classical
69{
70 if (!@_) {
71 %classical = %all_classical;
72 return;
73 }
74 if (@_==1 && $_[0] !~ $classical_mode) {
75 %classical = $_[0] ? %all_classical : ();
76 return;
77 }
78 while (@_) {
79 my $arg = shift;
80 if ($arg !~ $classical_mode) {
81 die "Unknown classical mode ($arg)\n";
82 }
83 if (@_ && $_[0] !~ $classical_mode) { $classical{$arg} = shift; }
84 else { $classical{$arg} = 1; }
85
86 if ($arg eq 'all') {
87 %classical = $classical{all} ? %all_classical : ();
88 }
89 }
90}
91
921100nsmy $persistent_count;
93
94sub NUM # (;$count,$show)
95{
96 if (defined $_[0])
97 {
98 $persistent_count = $_[0];
99 return $_[0] if !defined($_[1]) || $_[1];
100 }
101 else
102 {
103 $persistent_count = undef;
104 }
105 return '';
106}
107
108
109# 0. PERFORM GENERAL INFLECTIONS IN A STRING
110
11149163┬Ás
# spent 59┬Ás within Lingua::EN::Inflect::enclose which was called 49 times, avg 1┬Ás/call: # 4 times (4┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 613, avg 1┬Ás/call # once (4┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 470 # once (4┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 542 # once (3┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 550 # once (2┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 214 # once (2┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 375 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 1315 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 719 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 680 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 270 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 596 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 693 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 231 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 274 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 222 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 619 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 476 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 451 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 581 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 248 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 298 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 463 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 291 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 359 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 722 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 768 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 531 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 1321 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 341 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 483 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 307 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 490 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 371 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 757 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 257 # once (1┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 321 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 742 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 281 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 729 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 330 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 1326 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 747 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 736 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 458 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 497 # once (900ns+0s) by Pod::Wordlist::BEGIN@4 at line 349
sub enclose { "(?:$_[0])" }
112
113sub inflect
114{
115 my $save_persistent_count = $persistent_count;
116 my @sections = split /(NUM\([^)]*\))/, $_[0];
117 my $inflection = "";
118
119 foreach ( @sections )
120 {
121 unless (s/NUM\(\s*?(?:([^),]*)(?:,([^)]*))?)?\)/ NUM($1,$2) /xe)
122 {
123 1 while
124 s/\bPL \( ([^),]*) (, ([^)]*) )? \) / PL($1,$3) /xeg
125 || s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) / PL_N($1,$3) /xeg
126 || s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) / PL_V($1,$3) /xeg
127 || s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) / PL_ADJ($1,$3) /xeg
128 || s/\bAN? \( ([^),]*) (, ([^)]*) )? \) / A($1,$3) /xeg
129 || s/\bNO \( ([^),]*) (, ([^)]*) )? \) / NO($1,$3) /xeg
130 || s/\bORD \( ([^)]*) \) / ORD($1) /xeg
131 || s/\bNUMWORDS \( ([^)]*) \) / NUMWORDS($1) /xeg
132 || s/\bPART_PRES \( ([^)]*) \) / PART_PRES($1) /xeg
133 }
134
135 $inflection .= $_;
136 }
137
138 $persistent_count = $save_persistent_count;
139 return $inflection;
140}
141
142
143# 1. PLURALS
144
14519┬Ásmy %PL_sb_irregular_s =
146(
147 "corpus" => "corpuses|corpora",
148 "opus" => "opuses|opera",
149 "magnum opus" => "magnum opuses|magna opera",
150 "genus" => "genera",
151 "mythos" => "mythoi",
152 "penis" => "penises|penes",
153 "testis" => "testes",
154 "atlas" => "atlases|atlantes",
155 "yes" => "yeses",
156 'editio princeps' => 'editiones principes',
157 'starets' => 'startsy',
158 'staretz' => 'startzy',
159);
160
161123┬Ásmy %PL_sb_irregular =
162(
163 "child" => "children",
164 "brother" => "brothers|brethren",
165 "loaf" => "loaves",
166 "hoof" => "hoofs|hooves",
167 "beef" => "beefs|beeves",
168 "thief" => "thiefs|thieves",
169 "money" => "monies",
170 "mongoose" => "mongooses",
171 "ox" => "oxen",
172 "cow" => "cows|kine",
173 "graffito" => "graffiti",
174 "prima donna" => "prima donnas|prime donne",
175 "octopus" => "octopuses|octopodes",
176 "genie" => "genies|genii",
177 "ganglion" => "ganglions|ganglia",
178 "trilby" => "trilbys",
179 "turf" => "turfs|turves",
180 "numen" => "numina",
181 "atman" => "atmas",
182 "occiput" => "occiputs|occipita",
183 'sabretooth' => 'sabretooths',
184 'sabertooth' => 'sabertooths',
185 'lowlife' => 'lowlifes',
186 'flatfoot' => 'flatfoots',
187 'tenderfoot' => 'tenderfoots',
188 'Romany' => 'Romanies',
189 'romany' => 'romanies',
190 'Tornese' => 'Tornesi',
191 'Jerry' => 'Jerrys',
192 'jerry' => 'jerries',
193 'Mary' => 'Marys',
194 'mary' => 'maries',
195 'talouse' => 'talouses',
196 'blouse' => 'blouses',
197 'Rom' => 'Roma',
198 'rom' => 'roma',
199 'carmen' => 'carmina',
200 'cheval' => 'chevaux',
201 'chervonetz' => 'chervontzi',
202 'kuvasz' => 'kuvaszok',
203 'felo' => 'felones',
204 'put-off' => 'put-offs',
205 'set-off' => 'set-offs',
206 'set-out' => 'set-outs',
207 'set-to' => 'set-tos',
208 'brother-german' => 'brothers-german|brethren-german',
209 'studium generale' => 'studia generali',
210
211 %PL_sb_irregular_s,
212);
213
214125┬Ás212┬Ásmy $PL_sb_irregular = enclose join '|', reverse sort keys %PL_sb_irregular;
# spent 10┬Ás making 1 call to Lingua::EN::Inflect::CORE:sort # spent 2┬Ás making 1 call to Lingua::EN::Inflect::enclose
215
216# Z's that don't double
217
21811┬Ásmy @PL_sb_z_zes =
219(
220 "batz", "quartz", "topaz", "snooz(?=e)", "kibbutz",
221);
22212┬Ás11┬Ásmy $PL_sb_z_zes = enclose join '|', @PL_sb_z_zes;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
223
224# UNCONDITIONAL "..is" -> "..ides"
225
2261400nsmy @PL_sb_U_is_ides =
227(
228 "aphis",
229);
230
23113┬Ás11┬Ásmy $PL_sb_U_is_ides = enclose join "|", map { substr($_,0,-2) } @PL_sb_U_is_ides;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
232
233# CLASSICAL "..is" -> "..ides"
234
23511┬Ásmy @PL_sb_C_is_ides =
236(
237# GENERAL WORDS...
238
239 "ephemeris", "iris", "clitoris",
240 "chrysalis", "epididymis",
241
242# INFLAMATIONS...
243
244 ".*itis",
245
246);
247
24814┬Ás11┬Ásmy $PL_sb_C_is_ides = enclose join "|", map { substr($_,0,-2) } @PL_sb_C_is_ides;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
249
250# UNCONDITIONAL "..a" -> "..ata"
251
2521600nsmy @PL_sb_U_a_ata =
253(
254 "plasmalemma", "pseudostoma",
255);
256
25712┬Ás11┬Ásmy $PL_sb_U_a_ata = enclose join "|", map { substr($_,0,-1) } @PL_sb_U_a_ata;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
258
259# CLASSICAL "..a" -> "..ata"
260
26113┬Ásmy @PL_sb_C_a_ata =
262(
263 "anathema", "bema", "carcinoma", "charisma", "diploma",
264 "dogma", "drama", "edema", "enema", "enigma", "lemma",
265 "lymphoma", "magma", "melisma", "miasma", "oedema",
266 "sarcoma", "schema", "soma", "stigma", "stoma", "trauma",
267 "gumma", "pragma", "bema",
268);
269
270113┬Ás11┬Ásmy $PL_sb_C_a_ata = enclose join "|", map { substr($_,0,-1) } @PL_sb_C_a_ata;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
271
272# UNCONDITIONAL "..a" -> "..ae"
273
27411┬Ás11┬Ásmy $PL_sb_U_a_ae = enclose join "|",
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
275(
276 "alumna", "alga", "vertebra", "persona"
277);
278
279# CLASSICAL "..a" -> "..ae"
280
28112┬Ás1900nsmy $PL_sb_C_a_ae = enclose join "|",
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
282(
283 "amoeba", "antenna", "formula", "hyperbola",
284 "medusa", "nebula", "parabola", "abscissa",
285 "hydra", "nova", "lacuna", "aurora", ".*umbra",
286 "flora", "fauna",
287);
288
289# CLASSICAL "..en" -> "..ina"
290
29113┬Ás11┬Ásmy $PL_sb_C_en_ina = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
292(
293 "stamen", "foramen", "lumen"
294);
295
296# UNCONDITIONAL "..um" -> "..a"
297
29816┬Ás11┬Ásmy $PL_sb_U_um_a = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
299(
300 "bacterium", "agendum", "desideratum", "erratum",
301 "stratum", "datum", "ovum", "extremum",
302 "candelabrum", "intermedium", "malum", "Progymnasium",
303);
304
305# CLASSICAL "..um" -> "..a"
306
307112┬Ás11┬Ásmy $PL_sb_C_um_a = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
308(
309 "maximum", "minimum", "momentum", "optimum",
310 "quantum", "cranium", "curriculum", "dictum",
311 "phylum", "aquarium", "compendium", "emporium",
312 "enconium", "gymnasium", "honorarium", "interregnum",
313 "lustrum", "memorandum", "millennium", "rostrum",
314 "spectrum", "speculum", "stadium", "trapezium",
315 "ultimatum", "medium", "vacuum", "velum",
316 "consortium",
317);
318
319# UNCONDITIONAL "..us" -> "i"
320
32116┬Ás11┬Ásmy $PL_sb_U_us_i = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
322(
323 "alumnus", "alveolus", "bacillus", "bronchus",
324 "locus", "nucleus", "stimulus", "meniscus",
325 "sarcophagus", "interradius", "perradius", "triradius",
326);
327
328# CLASSICAL "..us" -> "..i"
329
33017┬Ás1900nsmy $PL_sb_C_us_i = enclose join "|", map { substr($_,0,-2) }
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
331(
332 "focus", "radius", "genius",
333 "incubus", "succubus", "nimbus",
334 "fungus", "nucleolus", "stylus",
335 "torus", "umbilicus", "uterus",
336 "hippopotamus", "cactus",
337);
338
339# CLASSICAL "..us" -> "..us" (ASSIMILATED 4TH DECLENSION LATIN NOUNS)
340
34111┬Ás11┬Ásmy $PL_sb_C_us_us = enclose join "|",
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
342(
343 "status", "apparatus", "prospectus", "sinus",
344 "hiatus", "impetus", "plexus",
345);
346
347# UNCONDITIONAL "..on" -> "a"
348
34915┬Ás1900nsmy $PL_sb_U_on_a = enclose join "|", map { substr($_,0,-2) }
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
350(
351 "criterion", "perihelion", "aphelion",
352 "phenomenon", "prolegomenon", "noumenon",
353 "organon", "asyndeton", "hyperbaton",
354 "legomenon",
355);
356
357# CLASSICAL "..on" -> "..a"
358
35912┬Ás11┬Ásmy $PL_sb_C_on_a = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
360(
361 "oxymoron",
362);
363
364# CLASSICAL "..o" -> "..i" (BUT NORMALLY -> "..os")
365
36612┬Ásmy @PL_sb_C_o_i =
367(
368 "solo", "soprano", "basso", "alto",
369 "contralto", "tempo", "piano", "virtuoso",
370);
37114┬Ás11┬Ásmy $PL_sb_C_o_i = enclose join "|", map { substr($_,0,-1) } @PL_sb_C_o_i;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
372
373# ALWAYS "..o" -> "..os"
374
375111┬Ás12┬Ásmy $PL_sb_U_o_os = enclose join "|",
# spent 2┬Ás making 1 call to Lingua::EN::Inflect::enclose
376(
377 "^ado", "aficionado", "aggro",
378 "albino", "allegro", "ammo",
379 "Antananarivo", "archipelago", "armadillo",
380 "auto", "avocado", "Bamako",
381 "Barquisimeto", "bimbo", "bingo",
382 "Biro", "bolero", "Bolzano",
383 "bongo", "Boto", "burro",
384 "Cairo", "canto", "cappuccino",
385 "casino", "cello", "Chicago",
386 "Chimango", "cilantro", "cochito",
387 "coco", "Colombo", "Colorado",
388 "commando", "concertino", "contango",
389 "credo", "crescendo", "cyano",
390 "demo", "ditto", "Draco",
391 "dynamo", "embryo", "Esperanto",
392 "espresso", "euro", "falsetto",
393 "Faro", "fiasco", "Filipino",
394 "flamenco", "furioso", "generalissimo",
395 "Gestapo", "ghetto", "gigolo",
396 "gizmo", "Greensboro", "gringo",
397 "Guaiabero", "guano", "gumbo",
398 "gyro", "hairdo", "hippo",
399 "Idaho", "impetigo", "inferno",
400 "info", "intermezzo", "intertrigo",
401 "Iquico", "^ISO", "jumbo",
402 "junto", "Kakapo", "kilo",
403 "Kinkimavo", "Kokako", "Kosovo",
404 "Lesotho", "libero", "libido",
405 "libretto", "lido", "Lilo",
406 "limbo", "limo", "lineno",
407 "lingo", "lino", "livedo",
408 "loco", "logo", "lumbago",
409 "macho", "macro", "mafioso",
410 "magneto", "magnifico", "Majuro",
411 "Malabo", "manifesto", "Maputo",
412 "Maracaibo", "medico", "memo",
413 "metro", "Mexico", "micro",
414 "Milano", "Monaco", "mono",
415 "Montenegro", "Morocco", "Muqdisho",
416 "myo", "^NATO", "^NCO",
417 "neutrino", "^NGO", "Ningbo",
418 "octavo", "oregano", "Orinoco",
419 "Orlando", "Oslo", "^oto",
420 "panto", "Paramaribo", "Pardusco",
421 "pedalo", "photo", "pimento",
422 "pinto", "pleco", "Pluto",
423 "pogo", "polo", "poncho",
424 "Porto-Novo", "Porto", "pro",
425 "psycho", "pueblo", "quarto",
426 "Quito", "rhino", "risotto",
427 "rococo", "rondo", "Sacramento",
428 "saddo", "sago", "salvo",
429 "Santiago", "Sapporo", "Sarajevo",
430 "scherzando", "scherzo", "silo",
431 "sirocco", "sombrero", "staccato",
432 "sterno", "stucco", "stylo",
433 "sumo", "Taiko", "techno",
434 "terrazzo", "testudo", "timpano",
435 "tiro", "tobacco", "Togo",
436 "Tokyo", "torero", "Torino",
437 "Toronto", "torso", "tremolo",
438 "typo", "tyro", "ufo",
439 "UNESCO", "vaquero", "vermicello",
440 "verso", "vibrato", "violoncello",
441 "Virgo", "weirdo", "WHO",
442 "WTO", "Yamoussoukro", "yo-yo",
443 "zero", "Zibo",
444
445 @PL_sb_C_o_i,
446);
447
448
449# UNCONDITIONAL "..ch" -> "..chs"
450
45113┬Ás11┬Ásmy $PL_sb_U_ch_chs = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
452qw(
453 czech eunuch stomach
454);
455
456# UNCONDITIONAL "..[ei]x" -> "..ices"
457
45812┬Ás1900nsmy $PL_sb_U_ex_ices = enclose join "|", map { substr($_,0,-2) }
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
459(
460 "codex", "murex", "silex",
461);
462
46312┬Ás11┬Ásmy $PL_sb_U_ix_ices = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
464(
465 "radix", "helix",
466);
467
468# CLASSICAL "..[ei]x" -> "..ices"
469
47017┬Ás14┬Ásmy $PL_sb_C_ex_ices = enclose join "|", map { substr($_,0,-2) }
# spent 4┬Ás making 1 call to Lingua::EN::Inflect::enclose
471(
472 "vortex", "vertex", "cortex", "latex",
473 "pontifex", "apex", "index", "simplex",
474);
475
47612┬Ás11┬Ásmy $PL_sb_C_ix_ices = enclose join "|", map { substr($_,0,-2) }
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
477(
478 "appendix",
479);
480
481# ARABIC: ".." -> "..i"
482
48311┬Ás11┬Ásmy $PL_sb_C_i = enclose join "|",
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
484(
485 "afrit", "afreet", "efreet",
486);
487
488# HEBREW: ".." -> "..im"
489
49011┬Ás11┬Ásmy $PL_sb_C_im = enclose join "|",
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
491(
492 "goy", "seraph", "cherub", "zuz", "kibbutz",
493);
494
495# UNCONDITIONAL "..man" -> "..mans"
496
49713┬Ás1900nsmy $PL_sb_U_man_mans = enclose join "|",
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
498qw(
499 \bataman caiman cayman ceriman
500 \bdesman \bdolman \bfarman \bharman \bhetman
501 human \bleman ottoman shaman talisman
502 Alabaman Bahaman Burman German
503 Hiroshiman Liman Nakayaman Norman Oklahoman
504 Panaman Roman Selman Sonaman Tacoman Yakiman
505 Yokohaman Yuman
506);
507
50815┬Ásmy @PL_sb_uninflected_s =
509(
510# PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
511 "breeches", "britches", "pajamas", "pyjamas", "clippers", "gallows",
512 "hijinks", "headquarters", "pliers", "scissors", "testes", "herpes",
513 "pincers", "shears", "proceedings", "trousers",
514
515# UNASSIMILATED LATIN 4th DECLENSION
516
517 "cantus", "coitus", "nexus",
518
519# RECENT IMPORTS...
520 "contretemps", "corps", "debris",
521 ".*ois", "siemens",
522
523# DISEASES
524 ".*measles", "mumps",
525
526# MISCELLANEOUS OTHERS...
527 "diabetes", "jackanapes", ".*series", "species", "rabies",
528 "chassis", "innings", "news", "mews", "haggis",
529);
530
53112┬Ás11┬Ásmy $PL_sb_uninflected_herd = enclose join "|",
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
532# DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
533(
534 "wildebeest", "swine", "eland", "bison", "buffalo",
535 "elk", "rhinoceros", 'zucchini',
536 'caribou', 'dace', 'grouse', 'guinea[- ]fowl',
537 'haddock', 'hake', 'halibut', 'herring', 'mackerel',
538 'pickerel', 'pike', 'roe', 'seed', 'shad',
539 'snipe', 'teal', 'turbot', 'water[- ]fowl',
540);
541
54211┬Ás14┬Ásmy $PL_sb_lese_lesen = enclose join "|",
# spent 4┬Ás making 1 call to Lingua::EN::Inflect::enclose
543(
544 'Auslese',
545 'beerenauslese',
546 'Spaetlese',
547 'trockenbeerenauslese',
548);
549
55015┬Ás13┬Ásmy $PL_sb_uninflected = enclose join "|",
# spent 3┬Ás making 1 call to Lingua::EN::Inflect::enclose
551(
552# SOME FISH AND HERD ANIMALS
553 ".*fish", "tuna", "salmon", "mackerel", "trout",
554 "bream", "sea[- ]bass", "carp", "cod", "flounder", "whiting",
555
556 ".*deer", ".*sheep", "moose",
557
558# ALL NATIONALS ENDING IN -ese
559 "Portuguese", "Amoyese", "Borghese", "Congoese", "Faroese",
560 "Foochowese", "Genevese", "Genoese", "Gilbertese", "Hottentotese",
561 "Kiplingese", "Kongoese", "Lucchese", "Maltese", "Nankingese",
562 "Niasese", "Pekingese", "Piedmontese", "Pistoiese", "Sarawakese",
563 "Shavese", "Vermontese", "Wenchowese", "Yengeese",
564 ".*[nrlm]ese",
565
566# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
567
568 @PL_sb_uninflected_s,
569
570# DISEASES
571 ".*pox",
572
573
574# OTHER ODDITIES
575 "graffiti", "djinn", 'samuri',
576 '.*craft$', 'offspring', 'pence', 'quid', 'hertz',
577);
578
579# SINGULAR WORDS ENDING IN ...s (ALL INFLECT WITH ...es)
580
58114┬Ás11┬Ásmy $PL_sb_singular_s = enclose join '|',
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
582(
583 ".*ss",
584 "acropolis", "aegis", "alias", "asbestos", "bathos", "bias",
585 "bronchitis", "bursitis", "caddis", "cannabis",
586 "canvas", "chaos", "cosmos", "dais", "digitalis",
587 "epidermis", "ethos", "eyas", "gas", "glottis",
588 "hubris", "ibis", "lens", "mantis", "marquis", "metropolis",
589 "pathos", "pelvis", "polis", "rhinoceros",
590 "sassafras", "trellis", ".*us", "[A-Z].*es",
591
592 @PL_sb_C_is_ides,
593 @PL_sb_U_is_ides,
594);
595
59615┬Ás11┬Ásmy $PL_v_special_s = enclose join '|',
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
597(
598 $PL_sb_singular_s,
599 @PL_sb_uninflected_s,
600 keys %PL_sb_irregular_s,
601 '(.*[csx])is',
602 '(.*)ceps',
603 '[A-Z].*s',
604);
605
60612┬Ásmy %PL_sb_postfix_adj = (
607 'general' => ['(?!major|lieutenant|brigadier|adjutant|.*star)\S+'],
608 'martial' => [qw(court)],
609);
610
61111┬Ásforeach (keys %PL_sb_postfix_adj) {
612 $PL_sb_postfix_adj{$_} = enclose
61328┬Ás44┬Ás enclose(join('|', @{$PL_sb_postfix_adj{$_}}))
# spent 4┬Ás making 4 calls to Lingua::EN::Inflect::enclose, avg 1┬Ás/call
614 . "(?=(?:-|\\s+)$_)";
615}
616
61714┬Ásmy $PL_sb_postfix_adj = '(' . join('|', values %PL_sb_postfix_adj) . ')(.*)';
618
61916┬Ás11┬Ásmy $PL_prep = enclose join '|', qw (
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
620 about above across after against amid amidst among around as at athwart atop
621 barring before behind below beneath beside besides between betwixt beyond but by
622 circa
623 despite down during
624 except
625 failing for from
626 given
627 in inside into
628 like
629 minus
630 near next
631 of off on onto out outside over
632 pace past per plus pro
633 qua
634 round
635 sans save since
636 than through throughout thru thruout till times to toward towards
637 under underneath unlike until unto up upon
638 versus via vs
639 with within without worth
640);
641
64211┬Ásmy $PL_sb_prep_dual_compound = '(.*?)((?:-|\s+)(?:'.$PL_prep.'|d[eua])(?:-|\s+))a(?:-|\s+)(.*)';
643
6441800nsmy $PL_sb_prep_compound = '(.*?)((-|\s+)('.$PL_prep.'|d[eua])((-|\s+)(.*))?)';
645
646
647110┬Ásmy %PL_pron_nom =
648(
649# NOMINATIVE REFLEXIVE
650
651"i" => "we", "myself" => "ourselves",
652"you" => "you", "yourself" => "yourselves",
653"she" => "they", "herself" => "themselves",
654"he" => "they", "himself" => "themselves",
655"it" => "they", "itself" => "themselves",
656"they" => "they", "themself" => "themselves",
657
658# POSSESSIVE
659
660"mine" => "ours",
661"yours" => "yours",
662"hers" => "theirs",
663"his" => "theirs",
664"its" => "theirs",
665"theirs" => "theirs",
666);
667
66814┬Ásmy %PL_pron_acc =
669(
670# ACCUSATIVE REFLEXIVE
671
672"me" => "us", "myself" => "ourselves",
673"you" => "you", "yourself" => "yourselves",
674"her" => "them", "herself" => "themselves",
675"him" => "them", "himself" => "themselves",
676"it" => "them", "itself" => "themselves",
677"them" => "them", "themself" => "themselves",
678);
679
68013┬Ás11┬Ásmy $PL_pron_acc = enclose join '|', keys %PL_pron_acc;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
681
68215┬Ásmy %PL_v_irregular_pres =
683(
684# 1st PERS. SING. 2ND PERS. SING. 3RD PERS. SINGULAR
685# 3RD PERS. (INDET.)
686
687"am" => "are", "are" => "are", "is" => "are",
688"was" => "were", "were" => "were", "was" => "were",
689"have" => "have", "have" => "have", "has" => "have",
690"do" => "do", "do" => "do", "does" => "do",
691);
692
69312┬Ás11┬Ásmy $PL_v_irregular_pres = enclose join '|', keys %PL_v_irregular_pres;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
694
695122┬Ásmy %PL_v_ambiguous_pres =
696(
697# 1st PERS. SING. 2ND PERS. SING. 3RD PERS. SINGULAR
698# 3RD PERS. (INDET.)
699
700"act" => "act", "act" => "act", "acts" => "act",
701"blame" => "blame", "blame" => "blame", "blames" => "blame",
702"can" => "can", "can" => "can", "can" => "can",
703"must" => "must", "must" => "must", "must" => "must",
704"fly" => "fly", "fly" => "fly", "flies" => "fly",
705"copy" => "copy", "copy" => "copy", "copies" => "copy",
706"drink" => "drink", "drink" => "drink", "drinks" => "drink",
707"fight" => "fight", "fight" => "fight", "fights" => "fight",
708"fire" => "fire", "fire" => "fire", "fires" => "fire",
709"like" => "like", "like" => "like", "likes" => "like",
710"look" => "look", "look" => "look", "looks" => "look",
711"make" => "make", "make" => "make", "makes" => "make",
712"reach" => "reach", "reach" => "reach", "reaches" => "reach",
713"run" => "run", "run" => "run", "runs" => "run",
714"sink" => "sink", "sink" => "sink", "sinks" => "sink",
715"sleep" => "sleep", "sleep" => "sleep", "sleeps" => "sleep",
716"view" => "view", "view" => "view", "views" => "view",
717);
718
71915┬Ás11┬Ásmy $PL_v_ambiguous_pres = enclose join '|', keys %PL_v_ambiguous_pres;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
720
721
72212┬Ás11┬Ásmy $PL_v_irregular_non_pres = enclose join '|',
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
723(
724"did", "had", "ate", "made", "put",
725"spent", "fought", "sank", "gave", "sought",
726"shall", "could", "ought", "should",
727);
728
72911┬Ás1900nsmy $PL_v_ambiguous_non_pres = enclose join '|',
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
730(
731"thought", "saw", "bent", "will", "might", "cut",
732);
733
734# "..oes" -> "..oe" (the rest are "..oes" -> "o")
735
73612┬Ás1900nsmy $PL_v_oes_oe = enclose join "|",
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
737qw(
738 .*shoes .*hoes .*toes
739 canoes floes oboes roes throes woes
740);
741
74212┬Ás1900nsmy $PL_count_zero = enclose join '|',
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
743(
7440, "no", "zero", "nil"
745);
746
74712┬Ás1900nsmy $PL_count_one = enclose join '|',
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
748(
7491, "a", "an", "one", "each", "every", "this", "that",
750);
751
75212┬Ásmy %PL_adj_special =
753(
754"a" => "some", "an" => "some",
755"this" => "these", "that" => "those",
756);
75712┬Ás11┬Ásmy $PL_adj_special = enclose join '|', keys %PL_adj_special;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
758
75912┬Ásmy %PL_adj_poss =
760(
761"my" => "our",
762"your" => "your",
763"its" => "their",
764"her" => "their",
765"his" => "their",
766"their" => "their",
767);
76812┬Ás11┬Ásmy $PL_adj_poss = enclose join '|', keys %PL_adj_poss;
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
769
770
771sub checkpat
772{
773local $SIG{__WARN__} = sub {0};
774do {$@ =~ s/at.*?$//;
775 die "\nBad user-defined singular pattern:\n\t$@\n"}
776 if (!eval "'' =~ m/$_[0]/; 1;" or $@);
777return @_;
778}
779
780sub checkpatsubs
781{
782checkpat($_[0]);
783if (defined $_[1])
784{
785 local $SIG{__WARN__} = sub {0};
786 do {$@ =~ s/at.*?$//;
787 die "\nBad user-defined plural string: '$_[1]'\n\t$@\n"}
788 if (!eval "qq{$_[1]}; 1;" or $@);
789}
790return @_;
791}
792
7931300nsmy @PL_sb_user_defined = ();
7941100nsmy @PL_v_user_defined = ();
7951100nsmy @PL_adj_user_defined = ();
7961100nsmy @A_a_user_defined = ();
797
798sub def_noun
799{
800 unshift @PL_sb_user_defined, checkpatsubs(@_);
801 return 1;
802}
803
804sub def_verb
805{
806 unshift @PL_v_user_defined, checkpatsubs(@_[4,5]);
807 unshift @PL_v_user_defined, checkpatsubs(@_[2,3]);
808 unshift @PL_v_user_defined, checkpatsubs(@_[0,1]);
809 return 1;
810}
811
812sub def_adj
813{
814 unshift @PL_adj_user_defined, checkpatsubs(@_);
815 return 1;
816}
817
818sub def_a
819{
820unshift @A_a_user_defined, checkpat(@_,'a');
821return 1;
822}
823
824sub def_an
825{
826unshift @A_a_user_defined, checkpat(@_,'an');
827return 1;
828}
829
830sub ud_match
831
# spent 6.66ms within Lingua::EN::Inflect::ud_match which was called 3619 times, avg 2┬Ás/call: # 1220 times (2.48ms+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1272, avg 2┬Ás/call # 1220 times (2.23ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1188, avg 2┬Ás/call # 1179 times (1.95ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1033, avg 2┬Ás/call
{
8323619726┬Ásmy $word = shift;
83336191.76msfor (my $i=0; $i < @_; $i+=2)
834{
835 if ($word =~ /^(?:$_[$i])$/i)
836 {
837 last unless defined $_[$i+1];
838 return eval '"'.$_[$i+1].'"';
839 }
840}
84136198.49msreturn undef;
842}
843
844do
8451200ns{
84616┬Áslocal $SIG{__WARN__} = sub {0};
8471100nsmy $rcfile;
848
8491700ns$rcfile = $INC{'Lingua//EN/Inflect.pm'} || '';
85015┬Ás1600ns$rcfile =~ s/Inflect.pm$/.inflectrc/;
# spent 600ns making 1 call to Lingua::EN::Inflect::CORE:subst
8511100nsdo $rcfile or die "\nBad .inflectrc file ($rcfile):\n\t$@\n"
852if $rcfile && -r $rcfile && -s $rcfile;
853
85411┬Ás$rcfile = "$ENV{HOME}/.inflectrc" || '';
855115┬Ás16┬Ásdo $rcfile or die "\nBad .inflectrc file ($rcfile):\n\t$@\n"
# spent 6┬Ás making 1 call to Lingua::EN::Inflect::CORE:fteread
856if $rcfile && -r $rcfile && -s $rcfile;
857};
858
859sub postprocess # FIX PEDANTRY AND CAPITALIZATION :-)
860
# spent 13.0ms (10.8+2.19) within Lingua::EN::Inflect::postprocess which was called 1220 times, avg 11┬Ás/call: # 1220 times (10.8ms+2.19ms) by Lingua::EN::Inflect::PL at line 875, avg 11┬Ás/call
{
8611220400┬Ásmy ($orig, $inflected) = @_;
86212204.74ms1220577┬Ás$inflected =~ s/([^|]+)\|(.+)/ $classical{all}?$2:$1 /e;
# spent 577┬Ás making 1220 calls to Lingua::EN::Inflect::CORE:subst, avg 473ns/call
86312208.01ms36121.62msreturn $orig =~ /^I$/ ? $inflected
# spent 1.62ms making 3612 calls to Lingua::EN::Inflect::CORE:match, avg 447ns/call
864 : $orig =~ /^[A-Z]+$/ ? uc $inflected
865 : $orig =~ /^[A-Z]/ ? ucfirst $inflected
866 : $inflected;
867}
868
869sub PL
870# PL($word,$number)
871
# spent 675ms (18.7+656) within Lingua::EN::Inflect::PL which was called 1220 times, avg 553┬Ás/call: # 1220 times (18.7ms+656ms) by Pod::Spell::BEGIN@10 at line 24 of Pod/Wordlist.pm, avg 553┬Ás/call
{
8721220275┬Ásmy ($str, $count) = @_;
87312208.21ms12203.17msmy ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
# spent 3.17ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
8741220125┬Ásreturn $str unless $word;
87512205.81ms4839653msmy $plural = postprocess $word, _PL_special_adjective($word,$count)
# spent 511ms making 1179 calls to Lingua::EN::Inflect::_PL_noun, avg 434┬Ás/call # spent 98.4ms making 1220 calls to Lingua::EN::Inflect::_PL_special_verb, avg 81┬Ás/call # spent 30.3ms making 1220 calls to Lingua::EN::Inflect::_PL_special_adjective, avg 25┬Ás/call # spent 13.0ms making 1220 calls to Lingua::EN::Inflect::postprocess, avg 11┬Ás/call
876 || _PL_special_verb($word,$count)
877 || _PL_noun($word,$count);
87812202.47msreturn $pre.$plural.$post;
879}
880
881sub PL_N
882# PL_N($word,$number)
883{
884my ($str, $count) = @_;
885my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
886return $str unless $word;
887my $plural = postprocess $word, _PL_noun($word,$count);
888return $pre.$plural.$post;
889}
890
891sub PL_V
892# PL_V($word,$number)
893{
894my ($str, $count) = @_;
895my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
896return $str unless $word;
897my $plural = postprocess $word, _PL_special_verb($word,$count)
898 || _PL_general_verb($word,$count);
899return $pre.$plural.$post;
900}
901
902sub PL_ADJ
903# PL_ADJ($word,$number)
904{
905my ($str, $count) = @_;
906my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
907return $str unless $word;
908my $plural = postprocess $word, _PL_special_adjective($word,$count)
909 || $word;
910return $pre.$plural.$post;
911}
912
913sub PL_eq { _PL_eq(@_, \&PL_N) || _PL_eq(@_, \&PL_V) || _PL_eq(@_, \&PL_ADJ); }
914sub PL_N_eq { _PL_eq(@_, \&PL_N); }
915sub PL_V_eq { _PL_eq(@_, \&PL_V); }
916sub PL_ADJ_eq { _PL_eq(@_, \&PL_ADJ); }
917
918sub _PL_eq
919{
920my ( $word1, $word2, $PL ) = @_;
921my %classval = %classical;
922%classical = %all_classical;
923my $result = "";
924$result = "eq" if !$result && $word1 eq $word2;
925$result = "p:s" if !$result && $word1 eq &$PL($word2);
926$result = "s:p" if !$result && &$PL($word1) eq $word2;
927%classical = ();
928$result = "p:s" if !$result && $word1 eq &$PL($word2);
929$result = "s:p" if !$result && &$PL($word1) eq $word2;
930%classical = %classval;
931
932if ($PL == \&PL || $PL == \&PL_N)
933{
934 $result = "p:p"
935 if !$result && _PL_check_plurals_N($word1,$word2);
936 $result = "p:p"
937 if !$result && _PL_check_plurals_N($word2,$word1);
938}
939if ($PL == \&PL || $PL == \&PL_ADJ)
940{
941 $result = "p:p"
942 if !$result && _PL_check_plurals_ADJ($word1,$word2,$PL);
943}
944
945return $result;
946}
947
948sub _PL_reg_plurals
949{
950 $_[0] =~ /($_[1])($_[2]\|\1$_[3]|$_[3]\|\1$_[2])/
951}
952
953sub _PL_check_plurals_N
954{
955my $pair = "$_[0]|$_[1]";
956foreach ( values %PL_sb_irregular_s ) { return 1 if $_ eq $pair; }
957foreach ( values %PL_sb_irregular ) { return 1 if $_ eq $pair; }
958
959return 1 if
960 _PL_reg_plurals($pair, $PL_sb_U_a_ata, "as","ata")
961 || _PL_reg_plurals($pair, $PL_sb_C_a_ata, "as","ata")
962 || _PL_reg_plurals($pair, $PL_sb_U_is_ides, "is","ides")
963 || _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is","ides")
964 || _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s","e")
965 || _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens","ina")
966 || _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums","a")
967 || _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses","i")
968 || _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons","a")
969 || _PL_reg_plurals($pair, $PL_sb_C_o_i, "os","i")
970 || _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes","ices")
971 || _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes","ices")
972 || _PL_reg_plurals($pair, $PL_sb_C_i, "s","i")
973 || _PL_reg_plurals($pair, $PL_sb_C_im, "s","im")
974
975 || _PL_reg_plurals($pair, '.*eau', "s","x")
976 || _PL_reg_plurals($pair, '.*ieu', "s","x")
977 || _PL_reg_plurals($pair, '.*tri', "xes","ces")
978 || _PL_reg_plurals($pair, '.{2,}[yia]n', "xes","ges");
979
980
981return 0;
982}
983
984sub _PL_check_plurals_ADJ
985{
986my ( $word1a, $word2a ) = @_;
987my ( $word1b, $word2b ) = @_;
988
989$word1a = '' unless $word1a =~ s/'s?$//;
990$word2a = '' unless $word2a =~ s/'s?$//;
991$word1b = '' unless $word1b =~ s/s'$//;
992$word2b = '' unless $word2b =~ s/s'$//;
993
994if ($word1a)
995{
996 return 1 if $word2a && ( _PL_check_plurals_N($word1a, $word2a)
997 || _PL_check_plurals_N($word2a, $word1a) );
998 return 1 if $word2b && ( _PL_check_plurals_N($word1a, $word2b)
999 || _PL_check_plurals_N($word2b, $word1a) );
1000}
1001if ($word1b)
1002{
1003 return 1 if $word2a && ( _PL_check_plurals_N($word1b, $word2a)
1004 || _PL_check_plurals_N($word2a, $word1b) );
1005 return 1 if $word2b && ( _PL_check_plurals_N($word1b, $word2b)
1006 || _PL_check_plurals_N($word2b, $word1b) );
1007}
1008
1009
1010return "";
1011}
1012
1013sub _PL_noun
1014
# spent 511ms (172+339) within Lingua::EN::Inflect::_PL_noun which was called 1179 times, avg 434┬Ás/call: # 1179 times (172ms+339ms) by Lingua::EN::Inflect::PL at line 875, avg 434┬Ás/call
{
10151179303┬Ásmy ( $word, $count ) = @_;
1016117984┬Ásmy $value; # UTILITY VARIABLE
1017
1018# DEFAULT TO PLURAL
1019
10201179259┬Ás$count = $persistent_count
1021 if !defined($count) && defined($persistent_count);
1022
10231179287┬Ás$count = (defined $count and $count=~/^($PL_count_one)$/io
1024 or defined $count and $classical{zero}
1025 and $count=~/^($PL_count_zero)$/io)
1026 ? 1
1027 : 2;
1028
10291179121┬Ásreturn $word if $count==1;
1030
1031# HANDLE USER-DEFINED NOUNS
1032
103311791.05ms11791.95msreturn $value if defined($value = ud_match($word, @PL_sb_user_defined));
# spent 1.95ms making 1179 calls to Lingua::EN::Inflect::ud_match, avg 2┬Ás/call
1034
1035
1036# HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
1037
10381179155┬Ás$word eq '' and return $word;
1039
1040117912.8ms23649.56ms$word =~ /^($PL_sb_uninflected)$/i && !exists $PL_sb_irregular{$word} && $word !~ /^($PL_sb_lese_lesen)$/i
# spent 8.09ms making 1182 calls to Lingua::EN::Inflect::CORE:match, avg 7┬Ás/call # spent 1.47ms making 1182 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
1041 and return $word;
1042
10431176267┬Ás$classical{herd} and $word =~ /^($PL_sb_uninflected_herd)$/i
1044 and return $word;
1045
1046
1047# HANDLE ISOLATED IRREGULAR PLURALS
1048
1049117610.7ms23525.14ms$word =~ /^($PL_sb_irregular)$/i
# spent 3.64ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call # spent 1.50ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
1050 and return ( $PL_sb_irregular{$1} || $PL_sb_irregular{lc $1} );
1051117633.4ms235328.4ms$word =~ /(.*)\b($PL_sb_irregular)$/i
# spent 27.0ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 23┬Ás/call # spent 1.09ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 926ns/call # spent 271┬Ás making 1 call to utf8::SWASHNEW
1052 and return $1 . ( $PL_sb_irregular{$2} || $PL_sb_irregular{lc $2} );
1053
1054
1055# HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
1056
1057117614.0ms23524.35ms$word =~ /^(?:$PL_sb_postfix_adj)$/i
# spent 3.24ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call # spent 1.11ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 946ns/call
1058 and $value = $2
1059 and return _PL_noun($1,2)
1060 . $value;
1061
1062117610.5ms23522.90ms$word =~ /^(?:$PL_sb_prep_dual_compound)$/i
# spent 1.74ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call # spent 1.15ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 981ns/call
1063 and $value = [$2,$3]
1064 and return _PL_noun($1,2)
1065 . $value->[0]
1066 . _PL_noun($value->[1]);
1067
1068117611.5ms23523.43ms$word =~ /^(?:$PL_sb_prep_compound)$/i
# spent 2.35ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call # spent 1.08ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 922ns/call
1069 and $value = $2
1070 and return _PL_noun($1,2)
1071 . $value;
1072
1073# HANDLE PRONOUNS
1074
1075117613.5ms23525.44ms$word =~ /^((?:$PL_prep)\s+)($PL_pron_acc)$/i
# spent 4.01ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call # spent 1.43ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
1076 and return $1.$PL_pron_acc{lc($2)};
1077
10781176987┬Ás$value = $PL_pron_nom{lc($word)}
1079 and return $value;
1080
108111765.25ms23522.31ms$word =~ /^($PL_pron_acc)$/i
# spent 1.21ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call # spent 1.10ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 934ns/call
1082 and return $PL_pron_acc{lc($1)};
1083
1084
1085# HANDLE FAMILIES OF IRREGULAR PLURALS
1086
1087117654.0ms235251.2ms$word =~ /(.*$PL_sb_U_man_mans)$/i
# spent 50.1ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 43┬Ás/call # spent 1.04ms making 1176 calls to Lingua::EN::Inflect::CORE:regcomp, avg 881ns/call
1088 and return "$1s";
108911763.42ms11762.05ms$word =~ /(\S*)quy$/i
# spent 2.05ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call
1090 and return "$1quies";
109111762.63ms11761.33ms$word =~ /(\S*)(person)$/i and return $classical{persons}?"$1persons":"$1people";
# spent 1.33ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call
109211765.86ms11762.08ms$word =~ /(.*)man$/i and return "$1men";
# spent 2.08ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call
109311763.79ms11762.43ms$word =~ /(.*[ml])ouse$/i and return "$1ice";
# spent 2.43ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call
109411762.84ms11761.57ms$word =~ /(.*)goose$/i and return "$1geese";
# spent 1.57ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call
109511764.43ms11763.13ms$word =~ /(.*)tooth$/i and return "$1teeth";
# spent 3.13ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
109611764.76ms11763.44ms$word =~ /(.*)foot$/i and return "$1feet";
# spent 3.44ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
1097
1098# HANDLE UNASSIMILATED IMPORTS
1099
110011763.08ms11761.81ms$word =~ /(.*)ceps$/i and return $word;
# spent 1.81ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call
110111762.92ms11761.62ms$word =~ /(.*)zoon$/i and return "$1zoa";
# spent 1.62ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call
110211768.01ms11764.06ms$word =~ /(.*[csx])is$/i and return "$1es";
# spent 4.06ms making 1176 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
110311755.40ms23502.69ms$word =~ /(.*$PL_sb_U_a_ata)a$/i and return "$1ata";
# spent 1.44ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call # spent 1.25ms making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
110411756.34ms23503.58ms$word =~ /(.*$PL_sb_U_is_ides)is$/i and return "$1ides";
# spent 2.89ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call # spent 694┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 590ns/call
1105117513.7ms23508.10ms$word =~ /(.*$PL_sb_U_ch_chs)ch$/i and return "$1chs";
# spent 7.11ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 6┬Ás/call # spent 985┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 838ns/call
1106117510.5ms23507.80ms$word =~ /(.*$PL_sb_U_ex_ices)ex$/i and return "$1ices";
# spent 6.85ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 6┬Ás/call # spent 957┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 814ns/call
110711758.98ms23506.24ms$word =~ /(.*$PL_sb_U_ix_ices)ix$/i and return "$1ices";
# spent 5.29ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 5┬Ás/call # spent 944┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 803ns/call
1108117529.1ms235026.3ms$word =~ /(.*$PL_sb_U_um_a)um$/i and return "$1a";
# spent 25.3ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 22┬Ás/call # spent 993┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 845ns/call
1109117529.2ms235023.4ms$word =~ /(.*$PL_sb_U_us_i)us$/i and return "$1i";
# spent 22.2ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 19┬Ás/call # spent 1.23ms making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
1110117516.9ms235014.2ms$word =~ /(.*$PL_sb_U_on_a)on$/i and return "$1a";
# spent 13.2ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 11┬Ás/call # spent 978┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 833ns/call
1111117521.2ms235010.9ms$word =~ /(.*$PL_sb_U_a_ae)$/i and return "$1e";
# spent 9.97ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 8┬Ás/call # spent 925┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 787ns/call
111211759.91ms23507.19ms$word =~ /(.*$PL_sb_lese_lesen)$/i and return "$1n";
# spent 6.20ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 5┬Ás/call # spent 993┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 845ns/call
1113
1114# HANDLE INCOMPLETELY ASSIMILATED IMPORTS
1115
11161175247┬Ásif ($classical{ancient})
1117{
1118 $word =~ /(.*)trix$/i and return "$1trices";
1119 $word =~ /(.*)eau$/i and return "$1eaux";
1120 $word =~ /(.*)ieu$/i and return "$1ieux";
1121 $word =~ /(.{2,}[yia])nx$/i and return "$1nges";
1122 $word =~ /(.*$PL_sb_C_en_ina)en$/i and return "$1ina";
1123 $word =~ /(.*$PL_sb_C_ex_ices)ex$/i and return "$1ices";
1124 $word =~ /(.*$PL_sb_C_ix_ices)ix$/i and return "$1ices";
1125 $word =~ /(.*$PL_sb_C_um_a)um$/i and return "$1a";
1126 $word =~ /(.*$PL_sb_C_us_i)us$/i and return "$1i";
1127 $word =~ /(.*$PL_sb_C_us_us)$/i and return "$1";
1128 $word =~ /(.*$PL_sb_C_a_ae)$/i and return "$1e";
1129 $word =~ /(.*$PL_sb_C_a_ata)a$/i and return "$1ata";
1130 $word =~ /(.*$PL_sb_C_is_ides)is$/i and return "$1ides";
1131 $word =~ /(.*$PL_sb_C_o_i)o$/i and return "$1i";
1132 $word =~ /(.*$PL_sb_C_on_a)on$/i and return "$1a";
1133 $word =~ /$PL_sb_C_im$/i and return "${word}im";
1134 $word =~ /$PL_sb_C_i$/i and return "${word}i";
1135}
1136
1137
1138# HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
1139
1140117511.1ms23505.48ms$word =~ /^($PL_sb_singular_s)$/i and return "$1es";
# spent 4.27ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 4┬Ás/call # spent 1.21ms making 1175 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
114111581.96ms1158476┬Ás$word =~ /^([A-Z].*s)$/ and $classical{names} and return "$1es";
# spent 476┬Ás making 1158 calls to Lingua::EN::Inflect::CORE:match, avg 411ns/call
114211314.56ms22621.81ms$word =~ /^($PL_sb_z_zes)$/i and return "$1es";
# spent 1.03ms making 1131 calls to Lingua::EN::Inflect::CORE:regcomp, avg 908ns/call # spent 783┬Ás making 1131 calls to Lingua::EN::Inflect::CORE:match, avg 692ns/call
114311318.21ms11311.30ms$word =~ /^(.*[^z])(z)$/i and return "$1zzes";
# spent 1.30ms making 1131 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call
114411294.70ms11293.02ms$word =~ /^(.*)([cs]h|x|zz|ss)$/i and return "$1$2es";
# spent 3.02ms making 1129 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
1145# $word =~ /(.*)(us)$/i and return "$1$2es";
1146
1147# HANDLE ...f -> ...ves
1148
114910868.96ms10863.16ms$word =~ /(.*[eao])lf$/i and return "$1lves";
# spent 3.16ms making 1086 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
115010864.84ms10863.61ms$word =~ /(.*[^d])eaf$/i and return "$1eaves";
# spent 3.61ms making 1086 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
115110863.76ms10862.57ms$word =~ /(.*[nlw])ife$/i and return "$1ives";
# spent 2.57ms making 1086 calls to Lingua::EN::Inflect::CORE:match, avg 2┬Ás/call
115210864.88ms10863.63ms$word =~ /(.*)arf$/i and return "$1arves";
# spent 3.63ms making 1086 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
1153
1154# HANDLE ...y
1155
115610864.59ms10863.33ms$word =~ /(.*[aeiou])y$/i and return "$1ys";
# spent 3.33ms making 1086 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
115710833.99ms1083407┬Ás$word =~ /([A-Z].*y)$/ and $classical{names} and return "$1s";
# spent 407┬Ás making 1083 calls to Lingua::EN::Inflect::CORE:match, avg 376ns/call
115810805.48ms10803.99ms$word =~ /(.*)y$/i and return "$1ies";
# spent 3.99ms making 1080 calls to Lingua::EN::Inflect::CORE:match, avg 4┬Ás/call
1159
1160# HANDLE ...o
1161
1162105062.0ms210056.8ms$word =~ /$PL_sb_U_o_os$/i and return "${word}s";
# spent 55.5ms making 1050 calls to Lingua::EN::Inflect::CORE:match, avg 53┬Ás/call # spent 1.30ms making 1050 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
116310471.96ms1047691┬Ás$word =~ /[aeiou]o$/i and return "${word}s";
# spent 691┬Ás making 1047 calls to Lingua::EN::Inflect::CORE:match, avg 660ns/call
116410431.83ms1043538┬Ás$word =~ /o$/i and return "${word}es";
# spent 538┬Ás making 1043 calls to Lingua::EN::Inflect::CORE:match, avg 516ns/call
1165
1166
1167# OTHERWISE JUST ADD ...s
1168
116910309.34msreturn "${word}s";
1170}
1171
1172
1173sub _PL_special_verb
1174
# spent 98.4ms (69.5+28.9) within Lingua::EN::Inflect::_PL_special_verb which was called 1220 times, avg 81┬Ás/call: # 1220 times (69.5ms+28.9ms) by Lingua::EN::Inflect::PL at line 875, avg 81┬Ás/call
{
11751220283┬Ásmy ( $word, $count ) = @_;
11761220246┬Ás$count = $persistent_count
1177 if !defined($count) && defined($persistent_count);
11781220295┬Ás$count = (defined $count and $count=~/^($PL_count_one)$/io or
1179 defined $count and $classical{zero} and $count=~/^($PL_count_zero)$/io) ? 1
1180 : 2;
1181
118212205.66ms12211.02msreturn undef if $count=~/^($PL_count_one)$/io;
# spent 1.01ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 827ns/call # spent 7┬Ás making 1 call to Lingua::EN::Inflect::CORE:regcomp
1183
1184122024┬Ásmy $value; # UTILITY VARIABLE
1185
1186# HANDLE USER-DEFINED VERBS
1187
118812201.30ms12202.23msreturn $value if defined($value = ud_match($word, @PL_v_user_defined));
# spent 2.23ms making 1220 calls to Lingua::EN::Inflect::ud_match, avg 2┬Ás/call
1189
1190# HANDLE IRREGULAR PRESENT TENSE (SIMPLE AND COMPOUND)
1191
119212209.17ms24402.82ms$word =~ /^($PL_v_irregular_pres)((\s.*)?)$/i
# spent 1.56ms making 1220 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call # spent 1.25ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call
1193 and return $PL_v_irregular_pres{lc $1}.$2;
1194
1195# HANDLE IRREGULAR FUTURE, PRETERITE AND PERFECT TENSES
1196
1197122019.7ms24402.45ms$word =~ /^($PL_v_irregular_non_pres)((\s.*)?)$/i
# spent 1.37ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call # spent 1.09ms making 1220 calls to Lingua::EN::Inflect::CORE:regcomp, avg 889ns/call
1198 and return $word;
1199
1200# HANDLE PRESENT NEGATIONS (SIMPLE AND COMPOUND)
1201
120212205.14ms24402.16ms$word =~ /^($PL_v_irregular_pres)(n't(\s.*)?)$/i
# spent 1.24ms making 1220 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call # spent 928┬Ás making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 761ns/call
1203 and return $PL_v_irregular_pres{lc $1}.$2;
1204
120512202.65ms12201.20ms$word =~ /^\S+n't\b/i
# spent 1.20ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 982ns/call
1206 and return $word;
1207
1208# HANDLE SPECIAL CASES
1209
121012208.05ms24404.91ms$word =~ /^($PL_v_special_s)$/ and return undef;
# spent 3.56ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call # spent 1.36ms making 1220 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
121111754.16ms1175410┬Ás$word =~ /\s/ and return undef;
# spent 410┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 349ns/call
121211751.63ms1175352┬Ás$word =~ /^quizzes$/i and return "quiz";
# spent 352┬Ás making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 299ns/call
1213
1214# HANDLE STANDARD 3RD PERSON (CHOP THE ...(e)s OFF SINGLE WORDS)
1215
121611754.68ms11753.23ms$word =~ /^(.*)([cs]h|[x]|zz|ss)es$/i and return "$1$2";
# spent 3.23ms making 1175 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call
1217
121811742.34ms1174964┬Ás$word =~ /^(..+)ies$/i and return "$1y";
# spent 964┬Ás making 1174 calls to Lingua::EN::Inflect::CORE:match, avg 821ns/call
1219
1220117310.8ms23465.18ms$word =~ /($PL_v_oes_oe)$/ and return substr($1,0,-1);
# spent 3.72ms making 1173 calls to Lingua::EN::Inflect::CORE:match, avg 3┬Ás/call # spent 1.46ms making 1173 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call
122111739.13ms1173738┬Ás$word =~ /^(.+)oes$/i and return "$1o";
# spent 738┬Ás making 1173 calls to Lingua::EN::Inflect::CORE:match, avg 629ns/call
1222
122311732.82ms11731.28ms$word =~ /^(.*[^s])s$/i and return $1;
# spent 1.28ms making 1173 calls to Lingua::EN::Inflect::CORE:match, avg 1┬Ás/call
1224
1225# OTHERWISE, A REGULAR VERB (HANDLE ELSEWHERE)
1226
122711343.26msreturn undef;
1228}
1229
1230sub _PL_general_verb
1231{
1232my ( $word, $count ) = @_;
1233$count = $persistent_count
1234 if !defined($count) && defined($persistent_count);
1235$count = (defined $count and $count=~/^($PL_count_one)$/io or
1236 defined $count and $classical{zero} and $count=~/^($PL_count_zero)$/io) ? 1
1237 : 2;
1238
1239return $word if $count=~/^($PL_count_one)$/io;
1240
1241# HANDLE AMBIGUOUS PRESENT TENSES (SIMPLE AND COMPOUND)
1242
1243$word =~ /^($PL_v_ambiguous_pres)((\s.*)?)$/i
1244 and return $PL_v_ambiguous_pres{lc $1}.$2;
1245
1246# HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
1247
1248$word =~ /^($PL_v_ambiguous_non_pres)((\s.*)?)$/i
1249 and return $word;
1250
1251# OTHERWISE, 1st OR 2ND PERSON IS UNINFLECTED
1252
1253return $word;
1254
1255}
1256
1257sub _PL_special_adjective
1258
# spent 30.3ms (21.0+9.32) within Lingua::EN::Inflect::_PL_special_adjective which was called 1220 times, avg 25┬Ás/call: # 1220 times (21.0ms+9.32ms) by Lingua::EN::Inflect::PL at line 875, avg 25┬Ás/call
{
12591220214┬Ásmy ( $word, $count ) = @_;
12601220302┬Ás$count = $persistent_count
1261 if !defined($count) && defined($persistent_count);
12621220285┬Ás$count = (defined $count and $count=~/^($PL_count_one)$/io or
1263 defined $count and $classical{zero} and $count=~/^($PL_count_zero)$/io) ? 1
1264 : 2;
1265
126612202.97ms12211.15msreturn $word if $count=~/^($PL_count_one)$/io;
# spent 1.13ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 924ns/call # spent 18┬Ás making 1 call to Lingua::EN::Inflect::CORE:regcomp
1267
1268
1269# HANDLE USER-DEFINED ADJECTIVES
1270
1271122019┬Ásmy $value;
127212201.35ms12202.48msreturn $value if defined($value = ud_match($word, @PL_adj_user_defined));
# spent 2.48ms making 1220 calls to Lingua::EN::Inflect::ud_match, avg 2┬Ás/call
1273
1274# HANDLE KNOWN CASES
1275
127612208.47ms24402.54ms$word =~ /^($PL_adj_special)$/i
# spent 1.50ms making 1220 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call # spent 1.04ms making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 850ns/call
1277 and return $PL_adj_special{lc $1};
1278
1279# HANDLE POSSESSIVES
1280
128112205.41ms24402.30ms$word =~ /^($PL_adj_poss)$/i
# spent 1.36ms making 1220 calls to Lingua::EN::Inflect::CORE:regcomp, avg 1┬Ás/call # spent 942┬Ás making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 772ns/call
1282 and return $PL_adj_poss{lc $1};
1283
128412204.66ms1220848┬Ás$word =~ /^(.*)'s?$/ and do { my $pl = PL_N($1);
# spent 848┬Ás making 1220 calls to Lingua::EN::Inflect::CORE:match, avg 695ns/call
1285 return "$pl'" . ($pl =~ m/s$/ ? "" : "s");
1286 };
1287
1288# OTHERWISE, NO IDEA
1289
129012202.45msreturn undef;
1291
1292}
1293
1294
1295# 2. INDEFINITE ARTICLES
1296
1297# THIS PATTERN MATCHES STRINGS OF CAPITALS STARTING WITH A "VOWEL-SOUND"
1298# CONSONANT FOLLOWED BY ANOTHER CONSONANT, AND WHICH ARE NOT LIKELY
1299# TO BE REAL WORDS (OH, ALL RIGHT THEN, IT'S JUST MAGIC!)
1300
13011400nsmy $A_abbrev = q{
1302(?! FJO | [HLMNS]Y. | RY[EO] | SQU
1303 | ( F[LR]? | [HL] | MN? | N | RH? | S[CHKLMNPTVW]? | X(YL)?) [AEIOU])
1304[FHLMNRSX][A-Z]
1305};
1306
1307# THIS PATTERN CODES THE BEGINNINGS OF ALL ENGLISH WORDS BEGINING WITH A
1308# 'y' FOLLOWED BY A CONSONANT. ANY OTHER Y-CONSONANT PREFIX THEREFORE
1309# IMPLIES AN ABBREVIATION.
1310
13111200nsmy $A_y_cons = 'y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt)';
1312
1313# EXCEPTIONS TO EXCEPTIONS
1314
131512┬Ás11┬Ásmy $A_explicit_an = enclose join '|',
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
1316(
1317 "euler",
1318 "hour(?!i)", "heir", "honest", "hono",
1319);
1320
132111┬Ás11┬Ásmy $A_ordinal_an = enclose join '|',
# spent 1┬Ás making 1 call to Lingua::EN::Inflect::enclose
1322(
1323 "[aefhilmnorsx]-?th",
1324);
1325
132611┬Ás1900nsmy $A_ordinal_a = enclose join '|',
# spent 900ns making 1 call to Lingua::EN::Inflect::enclose
1327(
1328 "[bcdgjkpqtuvwyz]-?th",
1329);
1330
1331sub A {
1332 my ($str, $count) = @_;
1333 my ($pre, $word, $post) = ( $str =~ m/\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z/i );
1334 return $str unless $word;
1335 my $result = _indef_article($word,$count);
1336 return $pre.$result.$post;
1337}
1338
1339sub AN { goto &A }
1340
1341sub _indef_article {
1342 my ( $word, $count ) = @_;
1343
1344 $count = $persistent_count
1345 if !defined($count) && defined($persistent_count);
1346
1347 return "$count $word"
1348 if defined $count && $count!~/^($PL_count_one)$/io;
1349
1350 # HANDLE USER-DEFINED VARIANTS
1351
1352 my $value;
1353 return "$value $word"
1354 if defined($value = ud_match($word, @A_a_user_defined));
1355
1356 # HANDLE ORDINAL FORMS
1357
1358 $word =~ /^($A_ordinal_a)/i and return "a $word";
1359 $word =~ /^($A_ordinal_an)/i and return "an $word";
1360
1361 # HANDLE SPECIAL CASES
1362
1363 $word =~ /^($A_explicit_an)/i and return "an $word";
1364 $word =~ /^[aefhilmnorsx]$/i and return "an $word";
1365 $word =~ /^[bcdgjkpqtuvwyz]$/i and return "a $word";
1366
1367
1368 # HANDLE ABBREVIATIONS
1369
1370 $word =~ /^($A_abbrev)/ox and return "an $word";
1371 $word =~ /^[aefhilmnorsx][.-]/i and return "an $word";
1372 $word =~ /^[a-z][.-]/i and return "a $word";
1373
1374 # HANDLE CONSONANTS
1375
1376 $word =~ /^[^aeiouy]/i and return "a $word";
1377
1378 # HANDLE SPECIAL VOWEL-FORMS
1379
1380 $word =~ /^e[uw]/i and return "a $word";
1381 $word =~ /^onc?e\b/i and return "a $word";
1382 $word =~ /^uni([^nmd]|mo)/i and return "a $word";
1383 $word =~ /^ut[th]/i and return "an $word";
1384 $word =~ /^u[bcfhjkqrst][aeiou]/i and return "a $word";
1385
1386 # HANDLE SPECIAL CAPITALS
1387
1388 $word =~ /^U[NK][AIEO]?/ and return "a $word";
1389
1390 # HANDLE VOWELS
1391
1392 $word =~ /^[aeiou]/i and return "an $word";
1393
1394 # HANDLE y... (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
1395
1396 $word =~ /^($A_y_cons)/io and return "an $word";
1397
1398 # OTHERWISE, GUESS "a"
1399 return "a $word";
1400}
1401
1402# 2. TRANSLATE ZERO-QUANTIFIED $word TO "no PL($word)"
1403
1404sub NO
1405{
1406 my ($str, $count, $opt_ref) = @_;
1407 my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
1408
1409 $count = $persistent_count
1410 if !defined($count) && defined($persistent_count);
1411 $count = 0 unless $count;
1412
1413 if ($count =~ /^$PL_count_zero$/) {
1414 return "${pre}no ". PL($word,0) . $post ;
1415 }
1416
1417 $count = defined $opt_ref->{words_below} && $count < $opt_ref->{words_below}
1418 ? NUMWORDS($count)
1419 : $count;
1420
1421 if (defined $opt_ref->{comma} || defined $opt_ref->{comma_every}) {
1422 $opt_ref->{comma_every} = 3 if !defined $opt_ref->{comma_every};
1423 $opt_ref->{comma} = ',' if !defined $opt_ref->{comma}
1424 || $opt_ref->{comma} =~ /^\d+$/;
1425
1426 $count = _commify($count, @{$opt_ref}{'comma','comma_every'});
1427 }
1428
1429 return "$pre$count " . PL($word,$count) . $post
1430}
1431
1432sub _commify {
1433 my ($number, $comma, $every) = @_;
1434 return if !defined $comma;
1435 return if !defined $comma;
1436 $number =~ s{(?:(?<=^)|(?<=^-))(\d\d{$every,})}
1437 { my $n = $1;
1438 $n=~s/(?<=.)(?=(?:.{$every})+$)/$comma/g;
1439 $n;
1440 }e;
1441 return $number;
1442}
1443
1444# PARTICIPLES
1445
1446sub PART_PRES
1447{
1448 local $_ = PL_V(shift,2);
1449 s/ie$/y/
1450 or s/ue$/u/
1451 or s/([auy])e$/$1/
1452 or s/ski$/ski/
1453 or s/[^b]i$//
1454 or s/^(are|were)$/be/
1455 or s/^(had)$/hav/
1456 or s/(hoe)$/$1/
1457 or s/([^e])e$/$1/
1458 or m/er$/
1459 or s/([^aeiou][aeiouy]([bdgmnprst]))$/$1$2/;
1460 return "${_}ing";
1461}
1462
- -
1465# NUMERICAL INFLECTIONS
1466
146717┬Ásmy %nth =
1468(
1469 0 => 'th',
1470 1 => 'st',
1471 2 => 'nd',
1472 3 => 'rd',
1473 4 => 'th',
1474 5 => 'th',
1475 6 => 'th',
1476 7 => 'th',
1477 8 => 'th',
1478 9 => 'th',
1479 11 => 'th',
1480 12 => 'th',
1481 13 => 'th',
1482);
1483
1484
14851100nsmy %ordinal;
148614┬Ás@ordinal{qw(ty one two three five eight nine twelve )}=
1487 qw(tieth first second third fifth eighth ninth twelfth);
1488
148912┬Ásmy $ordinal_suff = join '|', keys %ordinal, "";
1490
14911500ns$ordinal{""} = 'th';
1492
1493sub ORD($)
1494{
1495 my $num = shift;
1496 if ($num =~ /\d/) {
1497 return $num . ($nth{$num%100} || $nth{$num%10});
1498 }
1499 else {
1500 $num =~ s/($ordinal_suff)\Z/$ordinal{$1}/;
1501 return $num;
1502 }
1503}
1504
1505
150612┬Ásmy %default_args =
1507(
1508 'group' => 0,
1509 'comma' => ',',
1510 'and' => 'and',
1511 'zero' => 'zero',
1512 'one' => 'one',
1513 'decimal' => 'point',
1514);
1515
151614┬Ásmy @unit = ('',qw(one two three four five six seven eight nine));
151711┬Ásmy @teen = qw(ten eleven twelve thirteen fourteen
1518 fifteen sixteen seventeen eighteen nineteen);
151911┬Ásmy @ten = ('','',qw(twenty thirty forty fifty sixty seventy eighty ninety));
15202539┬Ás1212┬Ásmy @mill = map { (my $val=$_) =~ s/_/illion/; " $val" }
# spent 12┬Ás making 12 calls to Lingua::EN::Inflect::CORE:subst, avg 975ns/call
1521 ('',qw(thousand m_ b_ tr_ quadr_ quint_ sext_ sept_ oct_ non_ dec_));
1522
1523
1524sub mill { my $ind = $_[0]||0;
1525 die "Number out of range\n" if $ind > $#mill;
1526 return $ind<@mill ? $mill[$ind] : ' ???illion'; }
1527
1528sub unit { return $unit[$_[0]]. mill($_[1]); }
1529
1530sub ten
1531{
1532 return $ten[$_[0]] . ($_[0]&&$_[1]?'-':'') . $unit[$_[1]] . mill($_[2])
1533 if $_[0] ne '1';
1534 return $teen[$_[1]]. $mill[$_[2]||0];
1535}
1536
1537sub hund
1538{
1539 return unit($_[0]) . " hundred" . ($_[1] || $_[2] ? " $_[4] " : '')
1540 . ten($_[1],$_[2]) . mill($_[3]) . ', ' if $_[0];
1541 return ten($_[1],$_[2]) . mill($_[3]) . ', ' if $_[1] || $_[2];
1542 return '';
1543}
1544
1545
1546sub enword
1547{
1548 my ($num,$group,$zero,$one,$comma,$and) = @_;
1549
1550 if ($group==1)
1551 {
1552 $num =~ s/(\d)/ ($1==1 ? " $one" : $1 ? unit($1) :" $zero")."$comma " /eg;
1553 }
1554 elsif ($group==2)
1555 {
1556 $num =~ s/(\d)(\d)/ ($1 ? ten($1,$2) : $2 ? " $zero " . unit($2) : " $zero $zero") . "$comma " /eg;
1557 $num =~ s/(\d)/ ($1 ? unit($1) :" $zero")."$comma " /e;
1558 }
1559 elsif ($group==3)
1560 {
1561 $num =~ s/(\d)(\d)(\d)/ ($1==1 ? " $one" : $1 ? unit($1) :" $zero")." ".($2 ? ten($2,$3) : $3 ? " $zero " . unit($3) : " $zero $zero") . "$comma " /eg;
1562 $num =~ s/(\d)(\d)/ ($1 ? ten($1,$2) : $2 ? " $zero " . unit($2) : " $zero $zero") . "$comma " /e;
1563 $num =~ s/(\d)/ ($1==1 ? " $one" : $1 ? unit($1) :" $zero")."$comma " /e;
1564 }
1565 elsif ($num+0==0) {
1566 $num = $zero;
1567 }
1568 elsif ($num+0==1) {
1569 $num = $one;
1570 }
1571 else {
1572 $num =~ s/\A\s*0+//;
1573 my $mill = 0;
1574 1 while $num =~ s/(\d)(\d)(\d)(?=\D*\Z)/ hund($1,$2,$3,$mill++,$and) /e;
1575 $num =~ s/(\d)(\d)(?=\D*\Z)/ ten($1,$2,$mill)."$comma " /e;
1576 $num =~ s/(\d)(?=\D*\Z)/ unit($1,$mill) . "$comma "/e;
1577 }
1578 return $num;
1579}
1580
1581sub NUMWORDS
1582{
1583 my $num = shift;
1584
1585 if (@_ % 2 and require Carp) {
1586 die "Missing value in option list (odd number of option args) at"
1587 . join ' line ', (caller)[1,2];
1588 }
1589
1590 my %arg = ( %default_args, @_ );
1591 my $group = $arg{group};
1592
1593 # Handle "stylistic" conversions (up to a given threshold)...
1594 if (exists $arg{threshold} && $num > $arg{threshold}) {
1595 my ($whole, $frac) = split /[.]/, $num;
1596 while ($arg{comma}) {
1597 $whole =~ s{ (\d) ( \d{3}(?:,|\z) ) }{$1,$2}xms
1598 or last;
1599 }
1600 return $frac ? "$whole.$frac" : $whole;
1601 }
1602
1603 die "Bad chunking option: $group\n" unless $group =~ /\A[0-3]\Z/;
1604 my $sign = ($num =~ /\A\s*\+/) ? "plus"
1605 : ($num =~ /\A\s*\-/) ? "minus"
1606 : '';
1607
1608 my ($zero, $one) = @arg{'zero','one'};
1609 my $comma = $arg{comma};
1610 my $and = $arg{'and'};
1611
1612 my $ord = $num =~ s/(st|nd|rd|th)\Z//;
1613 my @chunks = ($arg{decimal})
1614 ? $group ? split(/\./, $num) : split(/\./, $num, 2)
1615 : ($num);
1616
1617 my $first = 1;
1618
1619 if ($chunks[0] eq '') { $first=0; shift @chunks; }
1620
1621 foreach ( @chunks )
1622 {
1623 s/\D//g;
1624 $_ = '0' unless $_;
1625
1626 if (!$group && !$first) { $_ = enword($_,1,$zero,$one,$comma,$and) }
1627 else { $_ = enword($_,$group,$zero,$one,$comma,$and) }
1628
1629 s/, \Z//;
1630 s/\s+,/,/g;
1631 s/, (\S+)\s+\Z/ $and $1/ if !$group and $first;
1632 s/\s+/ /g;
1633 s/(\A\s|\s\Z)//g;
1634 $first = '' if $first;
1635 }
1636
1637 my @numchunks = ();
1638 if ($first =~ /0/)
1639 {
1640 unshift @chunks, '';
1641 }
1642 else
1643 {
1644 @numchunks = split /\Q$comma /, $chunks[0];
1645 }
1646
1647 $numchunks[-1] =~ s/($ordinal_suff)\Z/$ordinal{$1}/
1648 if $ord and @numchunks;
1649
1650 foreach (@chunks[1..$#chunks])
1651 {
1652 push @numchunks, $arg{decimal};
1653 push @numchunks, split /\Q$comma /;
1654 }
1655
1656 if (wantarray)
1657 {
1658 unshift @numchunks, $sign if $sign;
1659 return @numchunks
1660 }
1661 elsif ($group)
1662 {
1663 return ($sign?"$sign ":'') . join ", ", @numchunks;
1664 }
1665 else
1666 {
1667 $num = ($sign?"$sign ":'') . shift @numchunks;
1668 $first = ($num !~ /$arg{decimal}\Z/);
1669 foreach ( @numchunks )
1670 {
1671 if (/\A$arg{decimal}\Z/)
1672 {
1673 $num .= " $_";
1674 $first = 0;
1675 }
1676 elsif ($first)
1677 {
1678 $num .= "$comma $_";
1679 }
1680 else
1681 {
1682 $num .= " $_";
1683 }
1684 }
1685 return $num;
1686 }
1687}
1688
1689# Join words with commas and a trailing 'and' (when appropriate)...
1690
1691sub WORDLIST {
1692 my %opt;
1693 my @words;
1694
1695 for my $arg (@_) {
1696 if (ref $arg eq 'HASH' ) {
1697 %opt = (%opt, %{$arg});
1698 }
1699 else {
1700 push @words, $arg;
1701 }
1702 }
1703
1704 return "" if @words == 0;
1705 return "$words[0]" if @words == 1;
1706
1707 my $conj = exists($opt{conj}) ? $opt{conj} : 'and';
1708 if (@words == 2) {
1709 $conj =~ s/^ (?=\S) | (?<=\S) $/ /gxms;
1710 return "$words[0]$conj$words[1]";
1711 }
1712
1713 my $sep = exists $opt{sep} ? $opt{sep}
1714 : grep(/,/, @words) ? q{; }
1715 : q{, }
1716 ;
1717
1718 my $final_sep = !exists $opt{final_sep} ? "$sep $conj"
1719 : length($opt{final_sep}) == 0 ? $conj
1720 : "$opt{final_sep} $conj"
1721 ;
1722 $final_sep =~ s/\s+/ /gmxs;
1723 $final_sep =~ s/^ (?=[^\W\d_]) | (?<=\S) $/ /gxms;
1724
1725 return join($sep, @words[0..@words-2]) . "$final_sep$words[-1]";
1726}
1727
- -
17301166┬Ás1;
1731
1732__END__
 
# spent 6┬Ás within Lingua::EN::Inflect::CORE:fteread which was called: # once (6┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 855
sub Lingua::EN::Inflect::CORE:fteread; # opcode
# spent 341ms (341+271┬Ás) within Lingua::EN::Inflect::CORE:match which was called 75807 times, avg 5┬Ás/call: # 3612 times (1.62ms+0s) by Lingua::EN::Inflect::postprocess at line 863, avg 447ns/call # 1220 times (3.56ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1210, avg 3┬Ás/call # 1220 times (3.17ms+0s) by Lingua::EN::Inflect::PL at line 873, avg 3┬Ás/call # 1220 times (1.37ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1197, avg 1┬Ás/call # 1220 times (1.25ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1192, avg 1┬Ás/call # 1220 times (1.20ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1205, avg 982ns/call # 1220 times (1.13ms+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1266, avg 924ns/call # 1220 times (1.04ms+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1276, avg 850ns/call # 1220 times (1.01ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1182, avg 827ns/call # 1220 times (942┬Ás+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1281, avg 772ns/call # 1220 times (928┬Ás+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1202, avg 761ns/call # 1220 times (848┬Ás+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1284, avg 695ns/call # 1182 times (8.09ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1040, avg 7┬Ás/call # 1176 times (50.1ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1087, avg 43┬Ás/call # 1176 times (26.8ms+271┬Ás) by Lingua::EN::Inflect::_PL_noun at line 1051, avg 23┬Ás/call # 1176 times (4.06ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1102, avg 3┬Ás/call # 1176 times (4.01ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1075, avg 3┬Ás/call # 1176 times (3.64ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1049, avg 3┬Ás/call # 1176 times (3.44ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1096, avg 3┬Ás/call # 1176 times (3.24ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1057, avg 3┬Ás/call # 1176 times (3.13ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1095, avg 3┬Ás/call # 1176 times (2.43ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1093, avg 2┬Ás/call # 1176 times (2.35ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1068, avg 2┬Ás/call # 1176 times (2.08ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1092, avg 2┬Ás/call # 1176 times (2.05ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1089, avg 2┬Ás/call # 1176 times (1.81ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1100, avg 2┬Ás/call # 1176 times (1.74ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1062, avg 1┬Ás/call # 1176 times (1.62ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1101, avg 1┬Ás/call # 1176 times (1.57ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1094, avg 1┬Ás/call # 1176 times (1.33ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1091, avg 1┬Ás/call # 1176 times (1.21ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1081, avg 1┬Ás/call # 1175 times (25.3ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1108, avg 22┬Ás/call # 1175 times (22.2ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1109, avg 19┬Ás/call # 1175 times (13.2ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1110, avg 11┬Ás/call # 1175 times (9.97ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1111, avg 8┬Ás/call # 1175 times (7.11ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1105, avg 6┬Ás/call # 1175 times (6.85ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1106, avg 6┬Ás/call # 1175 times (6.20ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1112, avg 5┬Ás/call # 1175 times (5.29ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1107, avg 5┬Ás/call # 1175 times (4.27ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1140, avg 4┬Ás/call # 1175 times (3.23ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1216, avg 3┬Ás/call # 1175 times (2.89ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1104, avg 2┬Ás/call # 1175 times (1.44ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1103, avg 1┬Ás/call # 1175 times (410┬Ás+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1211, avg 349ns/call # 1175 times (352┬Ás+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1212, avg 299ns/call # 1174 times (964┬Ás+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1218, avg 821ns/call # 1173 times (3.72ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1220, avg 3┬Ás/call # 1173 times (1.28ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1223, avg 1┬Ás/call # 1173 times (738┬Ás+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1221, avg 629ns/call # 1158 times (476┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1141, avg 411ns/call # 1131 times (1.30ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1143, avg 1┬Ás/call # 1131 times (783┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1142, avg 692ns/call # 1129 times (3.02ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1144, avg 3┬Ás/call # 1086 times (3.63ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1152, avg 3┬Ás/call # 1086 times (3.61ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1150, avg 3┬Ás/call # 1086 times (3.33ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1156, avg 3┬Ás/call # 1086 times (3.16ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1149, avg 3┬Ás/call # 1086 times (2.57ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1151, avg 2┬Ás/call # 1083 times (407┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1157, avg 376ns/call # 1080 times (3.99ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1158, avg 4┬Ás/call # 1050 times (55.5ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1162, avg 53┬Ás/call # 1047 times (691┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1163, avg 660ns/call # 1043 times (538┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1164, avg 516ns/call
sub Lingua::EN::Inflect::CORE:match; # opcode
# spent 2┬Ás within Lingua::EN::Inflect::CORE:qr which was called: # once (2┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 66
sub Lingua::EN::Inflect::CORE:qr; # opcode
# spent 34.1ms within Lingua::EN::Inflect::CORE:regcomp which was called 34192 times, avg 996ns/call: # 1220 times (1.56ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1192, avg 1┬Ás/call # 1220 times (1.50ms+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1276, avg 1┬Ás/call # 1220 times (1.36ms+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1281, avg 1┬Ás/call # 1220 times (1.36ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1210, avg 1┬Ás/call # 1220 times (1.24ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1202, avg 1┬Ás/call # 1220 times (1.09ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1197, avg 889ns/call # 1182 times (1.47ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1040, avg 1┬Ás/call # 1176 times (1.50ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1049, avg 1┬Ás/call # 1176 times (1.43ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1075, avg 1┬Ás/call # 1176 times (1.15ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1062, avg 981ns/call # 1176 times (1.11ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1057, avg 946ns/call # 1176 times (1.10ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1081, avg 934ns/call # 1176 times (1.09ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1051, avg 926ns/call # 1176 times (1.08ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1068, avg 922ns/call # 1176 times (1.04ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1087, avg 881ns/call # 1175 times (1.25ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1103, avg 1┬Ás/call # 1175 times (1.23ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1109, avg 1┬Ás/call # 1175 times (1.21ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1140, avg 1┬Ás/call # 1175 times (993┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1108, avg 845ns/call # 1175 times (993┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1112, avg 845ns/call # 1175 times (985┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1105, avg 838ns/call # 1175 times (978┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1110, avg 833ns/call # 1175 times (957┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1106, avg 814ns/call # 1175 times (944┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1107, avg 803ns/call # 1175 times (925┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1111, avg 787ns/call # 1175 times (694┬Ás+0s) by Lingua::EN::Inflect::_PL_noun at line 1104, avg 590ns/call # 1173 times (1.46ms+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1220, avg 1┬Ás/call # 1131 times (1.03ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1142, avg 908ns/call # 1050 times (1.30ms+0s) by Lingua::EN::Inflect::_PL_noun at line 1162, avg 1┬Ás/call # once (18┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 66 # once (18┬Ás+0s) by Lingua::EN::Inflect::_PL_special_adjective at line 1266 # once (7┬Ás+0s) by Lingua::EN::Inflect::_PL_special_verb at line 1182
sub Lingua::EN::Inflect::CORE:regcomp; # opcode
# spent 10┬Ás within Lingua::EN::Inflect::CORE:sort which was called: # once (10┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 214
sub Lingua::EN::Inflect::CORE:sort; # opcode
# spent 590┬Ás within Lingua::EN::Inflect::CORE:subst which was called 1233 times, avg 478ns/call: # 1220 times (577┬Ás+0s) by Lingua::EN::Inflect::postprocess at line 862, avg 473ns/call # 12 times (12┬Ás+0s) by Pod::Wordlist::BEGIN@4 at line 1520, avg 975ns/call # once (600ns+0s) by Pod::Wordlist::BEGIN@4 at line 850
sub Lingua::EN::Inflect::CORE:subst; # opcode