blib/lib/Lingua/ENG/Inflect.pm

filter: Statementstmt 88.3% 455 / 515 Branchbran 81.5% 370 / 454 Conditioncond 50.4% 160 / 317 MC/DCmcdc 31.8% 51 / 160 Subroutinesub 76.0% 38 / 50 Podpod 27.2% 9 / 33 totaltotal 70.8% 1083 / 1529 CC 331 SCAR 40.4
CC
331
Cov
77%
_PL_check_plurals_ADJ
380.0
inflect
156.0
_PL_check_plurals_N
102.2
CRAP 56.6
↑ Summary
1 package Lingua::ENG::Inflect;
2 # ABSTRACT: Plural inflection for ENG.
3  
4 14 ▶use 5.16.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 14 ▶use vars qw(@EXPORT_OK %EXPORT_TAGS @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 14 ▶use Env;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 14 require Exporter;
12 14 @ISA = qw(Exporter);
13 14 our $VERSION = '0.2603270';
14  
15 14 %EXPORT_TAGS =
16 (
17 ALL => [ qw( classical inflect
18 PL PL_N PL_V PL_ADJ NO NUM A AN
19 PL_eq PL_N_eq PL_V_eq PL_ADJ_eq
20 PART_PRES
21 ORD
22 NUMWORDS
23 WORDLIST
24 def_noun def_verb def_adj def_a def_an )],
25  
26 INFLECTIONS => [ qw( classical inflect
27 PL PL_N PL_V PL_ADJ PL_eq
28 NO NUM A AN PART_PRES )],
29  
30 PLURALS => [ qw( classical inflect
31 PL PL_N PL_V PL_ADJ NO NUM
32 PL_eq PL_N_eq PL_V_eq PL_ADJ_eq )],
33  
34 COMPARISONS => [ qw( classical
35 PL_eq PL_N_eq PL_V_eq PL_ADJ_eq )],
36  
37 ARTICLES => [ qw( classical inflect NUM A AN )],
38  
39 NUMERICAL => [ qw( ORD NUMWORDS )],
40  
41 USER_DEFINED => [ qw( def_noun def_verb def_adj def_a def_an )],
42 );
43  
44 14 Exporter::export_ok_tags(qw( ALL ));
45  
46 # SUPPORT CLASSICAL PLURALIZATIONS
47  
48 14 my %def_classical = (
49 all => 0,
50 zero => 0,
51 herd => 0,
52 names => 1,
53 persons => 0,
54 ancient => 0,
55 );
56  
57 14 my %all_classical = (
58 all => 1,
59 zero => 1,
60 herd => 1,
61 names => 1,
62 persons => 1,
63 ancient => 1,
64 );
65  
66 14 my %classical = %def_classical;
67  
68 14 my $classical_mode = join '|', keys %all_classical;
69 14 $classical_mode = qr/^(?:$classical_mode)$/;
70  
71 sub classical
72 {
73 1712 ▶ if (!@_) {
Subroutine classical: called CC=11 SCAR=24.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
unless (@_) 1 1711 1712
74 1 %classical = %all_classical;
75 1 return;
76 }
77 1711 ▶ if (@_==1 && $_[0] !~ $classical_mode) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not $_[0] =~ /$classical_mode/u) 5 1706 1711
Condition100%3/3
@_ == 1 and not $_[0] =~ /$classical_mode/u
!ll&&!rl&&r
170065
MC/DC100%2/2
@_ == 1 and not $_[0] =~ /$classical_mode/u
@_ == 1 not $_[0] =~ /$classical_mode/u
Truth table100%3/3
A and not(B)
A= @_ == 1B= not $_[0] =~ /$classical_mode/u
ABresult
0X0
100
111
78 5 ▶ %classical = $_[0] ? %all_classical : ();
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 2 3 5
79 5 return;
80 }
81 1706 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2552 1706 4258
82 2552 my $arg = shift;
83 2552 ▶ if ($arg !~ $classical_mode) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arg =~ /$classical_mode/u) 0 2552 2552
84 0 die "Unknown classical mode ($arg)\n";
85 }
86 2552 ▶ if (@_ && $_[0] !~ $classical_mode) { $classical{$arg} = shift; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and not $_[0] =~ /$classical_mode/u) { } 2546 6 2552
Condition66%2/3
@_ and not $_[0] =~ /$classical_mode/u
!ll&&!rl&&r
602546
MC/DC50%1/2
@_ and not $_[0] =~ /$classical_mode/u
@_ not $_[0] =~ /$classical_mode/u
Truth table66%2/3
A and not(B)
A= @_B= not $_[0] =~ /$classical_mode/u
ABresult
0X0
100
111
87 6 else { $classical{$arg} = 1; }
88  
89 2552 ▶ if ($arg eq 'all') {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg eq "all") 1695 857 2552
90 1695 ▶ %classical = $classical{all} ? %all_classical : ();
Branch: 1 branch
BranchTrueFalseTotal
$classical{'all'} ? : 848 847 1695
91 }
92 }
93 }
94  
95 14 my $persistent_count;
96  
97 sub NUM # (;$count,$show)
98 {
99 0 ▶ if (defined $_[0])
Subroutine NUM: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) { } 0 0 0
100 {
101 0 $persistent_count = $_[0];
102 0 ▶ return $_[0] if !defined($_[1]) || $_[1];
Branch: 1 branch
BranchTrueFalseTotal
if not defined $_[1] or $_[1] 0 0 0
Condition0%0/3
not defined $_[1] or $_[1]
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $_[1] or $_[1]
not defined $_[1] $_[1]
Truth table0%0/3
not(A) or B
A= not defined $_[1]B= $_[1]
ABresult
1X1
011
000
103 }
104 else
105 {
106 0 $persistent_count = undef;
107 }
108 0 return '';
109 }
110  
111 # 0. PERFORM GENERAL INFLECTIONS IN A STRING
112  
113 602 ▶sub enclose { "(?:$_[0])" }
Subroutine enclose: called CC=1 SCAR=0.0
Pod undocumented
114  
115 sub inflect
116 {
117 0 ▶ my $save_persistent_count = $persistent_count;
Subroutine inflect: not called CC=12 SCAR=50.5
Pod undocumented
118 0 my @sections = split /(NUM\([^)]*\))/, $_[0];
119 0 my $inflection = "";
120  
121 0 foreach ( @sections )
122 {
123 0 ▶ unless (s/NUM\(\s*?(?:([^),]*)(?:,([^)]*))?)?\)/ NUM($1,$2) /xe)
Branch: 1 branch
BranchTrueFalseTotal
unless (s/NUM\(\s*?(?:([^),]*)(?:,([^)]*))?)?\)/NUM($1, $2);/eux) 0 0 0
124 {
125 0 ▶ 1 while
Branch: 1 branch
BranchTrueFalseTotal
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux || s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux || s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux || s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux || s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux || s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux || s/\bORD \( ([^)]*) \) /&ORD($1);/egux || s/\bNUMWORDS \( ([^)]*) \) /NUMWORDS($1);/egux || s/\bPART_PRES \( ([^)]*) \) /PART_PRES($1);/egux and do { '???' } 0 0 0
Condition0%0/24
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux or s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux or s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux or s/\bORD \( ([^)]*) \) /&ORD($1);/egux or s/\bNUMWORDS \( ([^)]*) \) /NUMWORDS($1);/egux or s/\bPART_PRES \( ([^)]*) \) /PART_PRES($1);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux or s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux or s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux or s/\bORD \( ([^)]*) \) /&ORD($1);/egux or s/\bNUMWORDS \( ([^)]*) \) /NUMWORDS($1);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux or s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux or s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux or s/\bORD \( ([^)]*) \) /&ORD($1);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux or s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux or s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux or s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux
l!l&&r!l&&!r
000
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux
l!l&&r!l&&!r
000
MC/DC0%0/9
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux or s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux or s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux or s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux or s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux or s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux or s/\bORD \( ([^)]*) \) /&ORD($1);/egux or s/\bNUMWORDS \( ([^)]*) \) /NUMWORDS($1);/egux or s/\bPART_PRES \( ([^)]*) \) /PART_PRES($1);/egux
s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/egux s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/egux s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/egux s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/egux s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/egux s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/egux s/\bORD \( ([^)]*) \) /&ORD($1);/egux s/\bNUMWORDS \( ([^)]*) \) /NUMWORDS($1);/egux s/\bPART_PRES \( ([^)]*) \) /PART_PRES($1);/egux
Truth table0%0/10
A or B or C or D or E or F or G or H or I
A= s/\bPL \( ([^),]*) (, ([^)]*) )? \) /PL($1, $3);/eguxB= s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) /PL_N($1, $3);/eguxC= s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) /PL_V($1, $3);/eguxD= s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) /PL_ADJ($1, $3);/eguxE= s/\bAN? \( ([^),]*) (, ([^)]*) )? \) /A($1, $3);/eguxF= s/\bNO \( ([^),]*) (, ([^)]*) )? \) /NO($1, $3);/eguxG= s/\bORD \( ([^)]*) \) /&ORD($1);/eguxH= s/\bNUMWORDS \( ([^)]*) \) /NUMWORDS($1);/eguxI= s/\bPART_PRES \( ([^)]*) \) /PART_PRES($1);/egux
ABCDEFGHIresult
1XXXXXXXX1
01XXXXXXX1
001XXXXXX1
0001XXXXX1
00001XXXX1
000001XXX1
0000001XX1
00000001X1
0000000011
0000000000
126 0 s/\bPL \( ([^),]*) (, ([^)]*) )? \) / PL($1,$3) /xeg
127 0 || s/\bPL_N \( ([^),]*) (, ([^)]*) )? \) / PL_N($1,$3) /xeg
128 0 || s/\bPL_V \( ([^),]*) (, ([^)]*) )? \) / PL_V($1,$3) /xeg
129 0 || s/\bPL_ADJ \( ([^),]*) (, ([^)]*) )? \) / PL_ADJ($1,$3) /xeg
130 0 || s/\bAN? \( ([^),]*) (, ([^)]*) )? \) / A($1,$3) /xeg
131 0 || s/\bNO \( ([^),]*) (, ([^)]*) )? \) / NO($1,$3) /xeg
132 0 || s/\bORD \( ([^)]*) \) / ORD($1) /xeg
133 0 || s/\bNUMWORDS \( ([^)]*) \) / NUMWORDS($1) /xeg
134 0 || s/\bPART_PRES \( ([^)]*) \) / PART_PRES($1) /xeg
135 }
136  
137 0 $inflection .= $_;
138 }
139  
140 0 $persistent_count = $save_persistent_count;
141 0 return $inflection;
142 }
143  
144 # 1. PLURALS
145  
146 14 my %PL_sb_irregular_s =
147 (
148 "corpus" => "corpuses|corpora",
149 "opus" => "opuses|opera",
150 "genus" => "genera",
151 "mythos" => "mythoi",
152 "penis" => "penises|penes",
153 "testis" => "testes",
154 "atlas" => "atlases|atlantes",
155 "yes" => "yeses",
156 );
157  
158 14 my %PL_sb_irregular =
159 (
160 "child" => "children",
161 "brother" => "brothers|brethren",
162 "loaf" => "loaves",
163 "hoof" => "hoofs|hooves",
164 "beef" => "beefs|beeves",
165 "thief" => "thiefs|thieves",
166 "money" => "monies",
167 "mongoose" => "mongooses",
168 "ox" => "oxen",
169 "cow" => "cows|kine",
170 "graffito" => "graffiti",
171 "prima donna" => "prima donnas|prime donne",
172 "octopus" => "octopuses|octopodes",
173 "genie" => "genies|genii",
174 "ganglion" => "ganglions|ganglia",
175 "trilby" => "trilbys",
176 "turf" => "turfs|turves",
177 "numen" => "numina",
178 "atman" => "atmas",
179 "occiput" => "occiputs|occipita",
180 'sabretooth' => 'sabretooths',
181 'sabertooth' => 'sabertooths',
182 'lowlife' => 'lowlifes',
183 'flatfoot' => 'flatfoots',
184 'tenderfoot' => 'tenderfoots',
185 'Romany' => 'Romanies',
186 'romany' => 'romanies',
187 'Jerry' => 'Jerrys',
188 'jerry' => 'jerries',
189 'Mary' => 'Marys',
190 'mary' => 'maries',
191 'talouse' => 'talouses',
192 'blouse' => 'blouses',
193 'Rom' => 'Roma',
194 'rom' => 'roma',
195  
196 %PL_sb_irregular_s,
197 );
198  
199 14 my $PL_sb_irregular = enclose join '|', keys %PL_sb_irregular;
200  
201 # CLASSICAL "..is" -> "..ides"
202  
203 14 my @PL_sb_C_is_ides =
204 (
205 # GENERAL WORDS...
206  
207 "ephemeris", "iris", "clitoris",
208 "chrysalis", "epididymis",
209  
210 # INFLAMATIONS...
211  
212 ".*itis",
213  
214 );
215  
216 14 my $PL_sb_C_is_ides = enclose join "|", map { substr($_,0,-2) } @PL_sb_C_is_ides;
217  
218 # CLASSICAL "..a" -> "..ata"
219  
220 14 my @PL_sb_C_a_ata =
221 (
222 "anathema", "bema", "carcinoma", "charisma", "diploma",
223 "dogma", "drama", "edema", "enema", "enigma", "lemma",
224 "lymphoma", "magma", "melisma", "miasma", "oedema",
225 "sarcoma", "schema", "soma", "stigma", "stoma", "trauma",
226 "gumma", "pragma",
227 );
228  
229 14 my $PL_sb_C_a_ata = enclose join "|", map { substr($_,0,-1) } @PL_sb_C_a_ata;
230  
231 # UNCONDITIONAL "..a" -> "..ae"
232  
233 14 my $PL_sb_U_a_ae = enclose join "|",
234 (
235 "alumna", "alga", "vertebra", "persona"
236 );
237  
238 # CLASSICAL "..a" -> "..ae"
239  
240 14 my $PL_sb_C_a_ae = enclose join "|",
241 (
242 "amoeba", "antenna", "formula", "hyperbola",
243 "medusa", "nebula", "parabola", "abscissa",
244 "hydra", "nova", "lacuna", "aurora", ".*umbra",
245 "flora", "fauna",
246 );
247  
248 # CLASSICAL "..en" -> "..ina"
249  
250 14 my $PL_sb_C_en_ina = enclose join "|", map { substr($_,0,-2) }
251 (
252 "stamen", "foramen", "lumen", "carmen"
253 );
254  
255 # UNCONDITIONAL "..um" -> "..a"
256  
257 14 my $PL_sb_U_um_a = enclose join "|", map { substr($_,0,-2) }
258 (
259 "bacterium", "agendum", "desideratum", "erratum",
260 "stratum", "datum", "ovum", "extremum",
261 "candelabrum",
262 );
263  
264 # CLASSICAL "..um" -> "..a"
265  
266 14 my $PL_sb_C_um_a = enclose join "|", map { substr($_,0,-2) }
267 (
268 "maximum", "minimum", "momentum", "optimum",
269 "quantum", "cranium", "curriculum", "dictum",
270 "phylum", "aquarium", "compendium", "emporium",
271 "enconium", "gymnasium", "honorarium", "interregnum",
272 "lustrum", "memorandum", "millennium", "rostrum",
273 "spectrum", "speculum", "stadium", "trapezium",
274 "ultimatum", "medium", "vacuum", "velum",
275 "consortium",
276 );
277  
278 # UNCONDITIONAL "..us" -> "i"
279  
280 14 my $PL_sb_U_us_i = enclose join "|", map { substr($_,0,-2) }
281 (
282 "alumnus", "alveolus", "bacillus", "bronchus",
283 "locus", "nucleus", "stimulus", "meniscus",
284 "sarcophagus",
285 );
286  
287 # CLASSICAL "..us" -> "..i"
288  
289 14 my $PL_sb_C_us_i = enclose join "|", map { substr($_,0,-2) }
290 (
291 "focus", "radius", "genius",
292 "incubus", "succubus", "nimbus",
293 "fungus", "nucleolus", "stylus",
294 "torus", "umbilicus", "uterus",
295 "hippopotamus", "cactus",
296 );
297  
298 # CLASSICAL "..us" -> "..us" (ASSIMILATED 4TH DECLENSION LATIN NOUNS)
299  
300 14 my $PL_sb_C_us_us = enclose join "|",
301 (
302 "status", "apparatus", "prospectus", "sinus",
303 "hiatus", "impetus", "plexus",
304 );
305  
306 # UNCONDITIONAL "..on" -> "a"
307  
308 14 my $PL_sb_U_on_a = enclose join "|", map { substr($_,0,-2) }
309 (
310 "criterion", "perihelion", "aphelion",
311 "phenomenon", "prolegomenon", "noumenon",
312 "organon", "asyndeton", "hyperbaton",
313 );
314  
315 # CLASSICAL "..on" -> "..a"
316  
317 14 my $PL_sb_C_on_a = enclose join "|", map { substr($_,0,-2) }
318 (
319 "oxymoron",
320 );
321  
322 # CLASSICAL "..o" -> "..i" (BUT NORMALLY -> "..os")
323  
324 14 my @PL_sb_C_o_i =
325 (
326 "solo", "soprano", "basso", "alto",
327 "contralto", "tempo", "piano", "virtuoso",
328 );
329 14 my $PL_sb_C_o_i = enclose join "|", map { substr($_,0,-1) } @PL_sb_C_o_i;
330  
331 # ALWAYS "..o" -> "..os"
332  
333 14 my $PL_sb_U_o_os = enclose join "|",
334 (
335 "^ado", "aficionado", "aggro",
336 "albino", "allegro", "ammo",
337 "Antananarivo", "archipelago", "armadillo",
338 "auto", "avocado", "Bamako",
339 "Barquisimeto", "bimbo", "bingo",
340 "Biro", "bolero", "Bolzano",
341 "bongo", "Boto", "burro",
342 "Cairo", "canto", "cappuccino",
343 "casino", "cello", "Chicago",
344 "Chimango", "cilantro", "cochito",
345 "coco", "Colombo", "Colorado",
346 "commando", "concertino", "contango",
347 "credo", "crescendo", "cyano",
348 "demo", "ditto", "Draco",
349 "dynamo", "embryo", "Esperanto",
350 "espresso", "euro", "falsetto",
351 "Faro", "fiasco", "Filipino",
352 "flamenco", "furioso", "generalissimo",
353 "Gestapo", "ghetto", "gigolo",
354 "gizmo", "Greensboro", "gringo",
355 "Guaiabero", "guano", "gumbo",
356 "gyro", "hairdo", "hippo",
357 "Idaho", "impetigo", "inferno",
358 "info", "intermezzo", "intertrigo",
359 "Iquico", "^ISO", "jumbo",
360 "junto", "Kakapo", "kilo",
361 "Kinkimavo", "Kokako", "Kosovo",
362 "Lesotho", "libero", "libido",
363 "libretto", "lido", "Lilo",
364 "limbo", "limo", "lineno",
365 "lingo", "lino", "livedo",
366 "loco", "logo", "lumbago",
367 "macho", "macro", "mafioso",
368 "magneto", "magnifico", "Majuro",
369 "Malabo", "manifesto", "Maputo",
370 "Maracaibo", "medico", "memo",
371 "metro", "Mexico", "micro",
372 "Milano", "Monaco", "mono",
373 "Montenegro", "Morocco", "Muqdisho",
374 "myo", "^NATO", "^NCO",
375 "neutrino", "^NGO", "Ningbo",
376 "octavo", "oregano", "Orinoco",
377 "Orlando", "Oslo", "^oto",
378 "panto", "Paramaribo", "Pardusco",
379 "pedalo", "photo", "pimento",
380 "pinto", "pleco", "Pluto",
381 "pogo", "polo", "poncho",
382 "Porto-Novo", "Porto", "pro",
383 "psycho", "pueblo", "quarto",
384 "Quito", "rhino", "risotto",
385 "rococo", "rondo", "Sacramento",
386 "saddo", "sago", "salvo",
387 "Santiago", "Sapporo", "Sarajevo",
388 "scherzando", "scherzo", "silo",
389 "sirocco", "sombrero", "staccato",
390 "sterno", "stucco", "stylo",
391 "sumo", "Taiko", "techno",
392 "terrazzo", "testudo", "timpano",
393 "tiro", "tobacco", "Togo",
394 "Tokyo", "torero", "Torino",
395 "Toronto", "torso", "tremolo",
396 "typo", "tyro", "ufo",
397 "UNESCO", "vaquero", "vermicello",
398 "verso", "vibrato", "violoncello",
399 "Virgo", "weirdo", "WHO",
400 "WTO", "Yamoussoukro", "yo-yo",
401 "zero", "Zibo",
402  
403 @PL_sb_C_o_i,
404 );
405  
406 # UNCONDITIONAL "..ch" -> "..chs"
407  
408 14 my $PL_sb_U_ch_chs = enclose join "|", map { substr($_,0,-2) }
409 qw(
410 czech eunuch stomach
411 );
412  
413 # UNCONDITIONAL "..[ei]x" -> "..ices"
414  
415 14 my $PL_sb_U_ex_ices = enclose join "|", map { substr($_,0,-2) }
416 (
417 "codex", "murex", "silex",
418 );
419  
420 14 my $PL_sb_U_ix_ices = enclose join "|", map { substr($_,0,-2) }
421 (
422 "radix", "helix",
423 );
424  
425 # CLASSICAL "..[ei]x" -> "..ices"
426  
427 14 my $PL_sb_C_ex_ices = enclose join "|", map { substr($_,0,-2) }
428 (
429 "vortex", "vertex", "cortex", "latex",
430 "pontifex", "apex", "index", "simplex",
431 );
432  
433 14 my $PL_sb_C_ix_ices = enclose join "|", map { substr($_,0,-2) }
434 (
435 "appendix",
436 );
437  
438 # ARABIC: ".." -> "..i"
439  
440 14 my $PL_sb_C_i = enclose join "|",
441 (
442 "afrit", "afreet", "efreet",
443 );
444  
445 # HEBREW: ".." -> "..im"
446  
447 14 my $PL_sb_C_im = enclose join "|",
448 (
449 "goy", "seraph", "cherub",
450 );
451  
452 # UNCONDITIONAL "..man" -> "..mans"
453  
454 14 my $PL_sb_U_man_mans = enclose join "|",
455 qw(
456 ataman caiman cayman ceriman
457 desman dolman farman harman hetman
458 human leman ottoman shaman talisman
459 Alabaman Bahaman Burman German
460 Hiroshiman Liman Nakayaman Norman Oklahoman
461 Panaman Roman Selman Sonaman Tacoman Yakiman
462 Yokohaman Yuman
463 );
464  
465 14 my @PL_sb_uninflected_s =
466 (
467 # PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
468 "breeches", "britches", "pajamas", "pyjamas", "clippers", "gallows",
469 "hijinks", "headquarters", "pliers", "scissors", "testes", "herpes",
470 "pincers", "shears", "proceedings", "trousers",
471  
472 # UNASSIMILATED LATIN 4th DECLENSION
473  
474 "cantus", "coitus", "nexus",
475  
476 # RECENT IMPORTS...
477 "contretemps", "corps", "debris",
478 ".*ois", "siemens",
479
480 # DISEASES
481 ".*measles", "mumps",
482  
483 # MISCELLANEOUS OTHERS...
484 "diabetes", "jackanapes", "series", "species", "rabies",
485 "chassis", "innings", "news", "mews", "haggis",
486 );
487  
488 14 my $PL_sb_uninflected_herd = enclose join "|",
489 # DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
490 (
491 "wildebeest", "swine", "eland", "bison", "buffalo",
492 "elk", "rhinoceros", 'zucchini',
493 'caribou', 'dace', 'grouse', 'guinea[- ]fowl',
494 'haddock', 'hake', 'halibut', 'herring', 'mackerel',
495 'pickerel', 'pike', 'roe', 'seed', 'shad',
496 'snipe', 'teal', 'turbot', 'water[- ]fowl',
497 );
498  
499 14 my $PL_sb_uninflected = enclose join "|",
500 (
501 # SOME FISH AND HERD ANIMALS
502 ".*fish", "tuna", "salmon", "mackerel", "trout",
503 "bream", "sea[- ]bass", "carp", "cod", "flounder", "whiting",
504  
505 ".*deer", ".*sheep", "moose",
506  
507 # ALL NATIONALS ENDING IN -ese
508 "Portuguese", "Amoyese", "Borghese", "Congoese", "Faroese",
509 "Foochowese", "Genevese", "Genoese", "Gilbertese", "Hottentotese",
510 "Kiplingese", "Kongoese", "Lucchese", "Maltese", "Nankingese",
511 "Niasese", "Pekingese", "Piedmontese", "Pistoiese", "Sarawakese",
512 "Shavese", "Vermontese", "Wenchowese", "Yengeese",
513 ".*[nrlm]ese",
514  
515 # SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
516  
517 @PL_sb_uninflected_s,
518  
519 # DISEASES
520 ".*pox",
521  
522 # OTHER ODDITIES
523 "graffiti", "djinn", 'samuri',
524 '.*craft$', 'offspring', 'pence', 'quid', 'hertz',
525 );
526  
527 # SINGULAR WORDS ENDING IN ...s (ALL INFLECT WITH ...es)
528  
529 14 my $PL_sb_singular_s = enclose join '|',
530 (
531 ".*ss",
532 "acropolis", "aegis", "alias", "asbestos", "bathos", "bias",
533 "bronchitis", "bursitis", "caddis", "cannabis",
534 "canvas", "chaos", "cosmos", "dais", "digitalis",
535 "epidermis", "ethos", "eyas", "gas", "glottis",
536 "hubris", "ibis", "lens", "mantis", "marquis", "metropolis",
537 "pathos", "pelvis", "polis", "rhinoceros",
538 "sassafras", "trellis", ".*us", "[A-Z].*es",
539
540 @PL_sb_C_is_ides,
541 );
542  
543 14 my $PL_v_special_s = enclose join '|',
544 (
545 $PL_sb_singular_s,
546 @PL_sb_uninflected_s,
547 keys %PL_sb_irregular_s,
548 '(.*[csx])is',
549 '(.*)ceps',
550 '[A-Z].*s',
551 );
552  
553 14 my %PL_sb_postfix_adj = (
554 'general' => ['(?!major|lieutenant|brigadier|adjutant)\S+'],
555 'martial' => [qw(court)],
556 );
557  
558 14 foreach (keys %PL_sb_postfix_adj) {
559 $PL_sb_postfix_adj{$_} = enclose
560 28 enclose(join('|', @{$PL_sb_postfix_adj{$_}}))
561 . "(?=(?:-|\\s+)$_)";
562 }
563  
564 14 my $PL_sb_postfix_adj = '(' . join('|', values %PL_sb_postfix_adj) . ')(.*)';
565  
566 14 my $PL_sb_military = 'major|lieutenant|brigadier|adjutant|quartermaster';
567 14 my $PL_sb_general = '((?!'.$PL_sb_military.').*?)((-|\s+)general)';
568  
569 14 my $PL_prep = enclose join '|', qw (
570 about above across after among around at athwart before behind
571 below beneath beside besides between betwixt beyond but by
572 during except for from in into near of off on onto out over
573 since till to under until unto upon with
574 );
575  
576 14 my $PL_sb_prep_dual_compound = '(.*?)((?:-|\s+)(?:'.$PL_prep.'|d[eua])(?:-|\s+))a(?:-|\s+)(.*)';
577  
578 14 my $PL_sb_prep_compound = '(.*?)((-|\s+)('.$PL_prep.'|d[eua])((-|\s+)(.*))?)';
579  
580 14 my %PL_pron_nom =
581 (
582 # NOMINATIVE REFLEXIVE
583  
584 "i" => "we", "myself" => "ourselves",
585 "you" => "you", "yourself" => "yourselves",
586 "she" => "they", "herself" => "themselves",
587 "he" => "they", "himself" => "themselves",
588 "it" => "they", "itself" => "themselves",
589 "they" => "they", "themself" => "themselves",
590  
591 # POSSESSIVE
592  
593 "mine" => "ours",
594 "yours" => "yours",
595 "hers" => "theirs",
596 "his" => "theirs",
597 "its" => "theirs",
598 "theirs" => "theirs",
599 );
600  
601 14 my %PL_pron_acc =
602 (
603 # ACCUSATIVE REFLEXIVE
604  
605 "me" => "us", "myself" => "ourselves",
606 "you" => "you", "yourself" => "yourselves",
607 "her" => "them", "herself" => "themselves",
608 "him" => "them", "himself" => "themselves",
609 "it" => "them", "itself" => "themselves",
610 "them" => "them", "themself" => "themselves",
611 );
612  
613 14 my $PL_pron_acc = enclose join '|', keys %PL_pron_acc;
614  
615 14 my %PL_v_irregular_pres =
616 (
617 # 1st PERS. SING. 2ND PERS. SING. 3RD PERS. SINGULAR
618 # 3RD PERS. (INDET.)
619  
620 "am" => "are", "are" => "are", "is" => "are",
621 "was" => "were", "were" => "were", "was" => "were",
622 "have" => "have", "have" => "have", "has" => "have",
623 "do" => "do", "do" => "do", "does" => "do",
624 );
625  
626 14 my $PL_v_irregular_pres = enclose join '|', keys %PL_v_irregular_pres;
627  
628 14 my %PL_v_ambiguous_pres =
629 (
630 # 1st PERS. SING. 2ND PERS. SING. 3RD PERS. SINGULAR
631 # 3RD PERS. (INDET.)
632  
633 "act" => "act", "act" => "act", "acts" => "act",
634 "blame" => "blame", "blame" => "blame", "blames" => "blame",
635 "can" => "can", "can" => "can", "can" => "can",
636 "must" => "must", "must" => "must", "must" => "must",
637 "fly" => "fly", "fly" => "fly", "flies" => "fly",
638 "copy" => "copy", "copy" => "copy", "copies" => "copy",
639 "drink" => "drink", "drink" => "drink", "drinks" => "drink",
640 "fight" => "fight", "fight" => "fight", "fights" => "fight",
641 "fire" => "fire", "fire" => "fire", "fires" => "fire",
642 "like" => "like", "like" => "like", "likes" => "like",
643 "look" => "look", "look" => "look", "looks" => "look",
644 "make" => "make", "make" => "make", "makes" => "make",
645 "reach" => "reach", "reach" => "reach", "reaches" => "reach",
646 "run" => "run", "run" => "run", "runs" => "run",
647 "sink" => "sink", "sink" => "sink", "sinks" => "sink",
648 "sleep" => "sleep", "sleep" => "sleep", "sleeps" => "sleep",
649 "view" => "view", "view" => "view", "views" => "view",
650 );
651  
652 14 my $PL_v_ambiguous_pres = enclose join '|', keys %PL_v_ambiguous_pres;
653  
654 14 my $PL_v_irregular_non_pres = enclose join '|',
655 (
656 "did", "had", "ate", "made", "put",
657 "spent", "fought", "sank", "gave", "sought",
658 "shall", "could", "ought", "should",
659 );
660  
661 14 my $PL_v_ambiguous_non_pres = enclose join '|',
662 (
663 "thought", "saw", "bent", "will", "might", "cut",
664 );
665  
666 # "..oes" -> "..oe" (the rest are "..oes" -> "o")
667  
668 14 my $PL_v_oes_oe = enclose join "|",
669 qw(
670 .*shoes .*hoes .*toes
671 canoes floes oboes roes throes woes
672 );
673  
674 14 my $PL_count_zero = enclose join '|',
675 (
676 0, "no", "zero", "nil"
677 );
678  
679 14 my $PL_count_one = enclose join '|',
680 (
681 1, "a", "an", "one", "each", "every", "this", "that",
682 );
683  
684 14 my %PL_adj_special =
685 (
686 "a" => "some", "an" => "some",
687 "this" => "these", "that" => "those",
688 );
689 14 my $PL_adj_special = enclose join '|', keys %PL_adj_special;
690  
691 14 my %PL_adj_poss =
692 (
693 "my" => "our",
694 "your" => "your",
695 "its" => "their",
696 "her" => "their",
697 "his" => "their",
698 "their" => "their",
699 );
700 14 my $PL_adj_poss = enclose join '|', keys %PL_adj_poss;
701  
702 sub checkpat
703 {
704 0 ▶local $SIG{__WARN__} = sub {0};
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine checkpat: called CC=3 SCAR=15.0
Pod undocumented
705 6 ▶do {$@ =~ s/at.*?$//;
Branch: 1 branch
BranchTrueFalseTotal
if (not eval "'' =~ m/$_[0]/; 1;" or $@) 0 6 6
Condition33%1/3
not eval "'' =~ m/$_[0]/; 1;" or $@
l!l&&r!l&&!r
006
MC/DC0%0/2
not eval "'' =~ m/$_[0]/; 1;" or $@
not eval "'' =~ m/$_[0]/; 1;" $@
Truth table33%1/3
not(A) or B
A= not eval "'' =~ m/$_[0]/; 1;"B= $@
ABresult
1X1
011
000
706 0 die "\nBad user-defined singular pattern:\n\t$@\n"}
707 if (!eval "'' =~ m/$_[0]/; 1;" or $@);
708 6 return @_;
709 }
710  
711 sub checkpatsubs
712 {
713 6 ▶checkpat($_[0]);
Subroutine checkpatsubs: called CC=4 SCAR=16.1
Pod undocumented
714 6 ▶if (defined $_[1])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) 6 0 6
715 {
716 6 ▶ local $SIG{__WARN__} = sub {0};
Subroutine __ANON__: called CC=1 SCAR=0.0
717 6 ▶ do {$@ =~ s/at.*?$//;
Branch: 1 branch
BranchTrueFalseTotal
if (not eval "qq{$_[1]}; 1;" or $@) 0 6 6
Condition33%1/3
not eval "qq{$_[1]}; 1;" or $@
l!l&&r!l&&!r
006
MC/DC0%0/2
not eval "qq{$_[1]}; 1;" or $@
not eval "qq{$_[1]}; 1;" $@
Truth table33%1/3
not(A) or B
A= not eval "qq{$_[1]}; 1;"B= $@
ABresult
1X1
011
000
718 0 die "\nBad user-defined plural string: '$_[1]'\n\t$@\n"}
719 if (!eval "qq{$_[1]}; 1;" or $@);
720 }
721 6 return @_;
722 }
723  
724 14 my @PL_sb_user_defined = ();
725 14 my @PL_v_user_defined = ();
726 14 my @PL_adj_user_defined = ();
727 14 my @A_a_user_defined = ();
728  
729 sub def_noun
730 {
731 2 ▶ unshift @PL_sb_user_defined, checkpatsubs(@_);
Subroutine def_noun: called CC=1 SCAR=0.0
Pod documented
732 2 return 1;
733 }
734  
735 sub def_verb
736 {
737 1 ▶ unshift @PL_v_user_defined, checkpatsubs(@_[4,5]);
Subroutine def_verb: called CC=1 SCAR=0.0
Pod documented
738 1 unshift @PL_v_user_defined, checkpatsubs(@_[2,3]);
739 1 unshift @PL_v_user_defined, checkpatsubs(@_[0,1]);
740 1 return 1;
741 }
742  
743 sub def_adj
744 {
745 1 ▶ unshift @PL_adj_user_defined, checkpatsubs(@_);
Subroutine def_adj: called CC=1 SCAR=0.0
Pod documented
746 1 return 1;
747 }
748  
749 sub def_a
750 {
751 0 ▶unshift @A_a_user_defined, checkpat(@_,'a');
Subroutine def_a: not called CC=1 SCAR=6.9
Pod documented
752 0 return 1;
753 }
754  
755 sub def_an
756 {
757 0 ▶unshift @A_a_user_defined, checkpat(@_,'an');
Subroutine def_an: not called CC=1 SCAR=6.9
Pod documented
758 0 return 1;
759 }
760  
761 sub ud_match
762 {
763 13744 ▶my $word = shift;
Subroutine ud_match: called CC=4 SCAR=13.9
Pod undocumented
764 13744 ▶for (my $i=0; $i < @_; $i+=2)
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @_) 44 13736 13780
765 {
766 44 ▶ if ($word =~ /^(?:$_[$i])$/i)
Branch: 1 branch
BranchTrueFalseTotal
if ($word =~ /^(?:$_[$i])$/iu) 8 36 44
767 {
768 8 ▶ last unless defined $_[$i+1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[$i + 1] 0 8 8
769 8 return eval '"'.$_[$i+1].'"';
770 }
771 }
772 13736 return;
773 }
774  
775 do
776 14 {
777 0 ▶local $SIG{__WARN__} = sub {0};
Subroutine __ANON__: not called CC=1 SCAR=1.2
778 14 my $rcfile;
779  
780 14 ▶$rcfile = $INC{'Lingua//ENG/Inflect.pm'} || '';
Condition50%1/2
$INC{'Lingua//ENG/Inflect.pm'} || ''
l!l
014
MC/DC0%0/1
$INC{'Lingua//ENG/Inflect.pm'} || ''
$INC{'Lingua//ENG/Inflect.pm'}
Truth table50%1/2
A
A= $INC{'Lingua//ENG/Inflect.pm'}
Aresult
11
00
781 14 $rcfile =~ s/Inflect.pm$/.inflectrc/;
782 14 ▶do $rcfile or die "\nBad .inflectrc file ($rcfile):\n\t$@\n"
Branch: 1 branch
BranchTrueFalseTotal
if $rcfile and -r $rcfile and -s $rcfile 0 14 14
Condition27%3/11
$rcfile && -r $rcfile && -s $rcfile && (do $rcfile || die("\nBad .inflectrc file ($rcfile):\n\t$@\n"))
!ll&&!rl&&r
1400
$rcfile and -r $rcfile and -s $rcfile
!ll&&!rl&&r
1400
$rcfile and -r $rcfile
!ll&&!rl&&r
1400
do $rcfile or die "\nBad .inflectrc file ($rcfile):\n\t$@\n"
l!l
00
MC/DC0%0/4
$rcfile && -r $rcfile && -s $rcfile && (do $rcfile || die("\nBad .inflectrc file ($rcfile):\n\t$@\n"))
$rcfile -r $rcfile -s $rcfile do $rcfile
Truth table0%0/5
A and B and C && D
A= $rcfileB= -r $rcfileC= -s $rcfileD= do $rcfile
ABCDresult
0XXX0
10XX0
110X0
11100
11111
783 if $rcfile && -r $rcfile && -s $rcfile;
784  
785 14 ▶$rcfile = "$ENV{HOME}/.inflectrc" || '';
Condition50%1/2
"$ENV{'HOME'}/.inflectrc" || ''
l!l
140
MC/DC0%0/1
"$ENV{'HOME'}/.inflectrc" || ''
"$ENV{'HOME'}/.inflectrc"
Truth table50%1/2
A
A= "$ENV{'HOME'}/.inflectrc"
Aresult
11
00
786 14 ▶do $rcfile or die "\nBad .inflectrc file ($rcfile):\n\t$@\n"
Branch: 1 branch
BranchTrueFalseTotal
if $rcfile and -r $rcfile and -s $rcfile 0 14 14
Condition27%3/11
$rcfile && -r $rcfile && -s $rcfile && (do $rcfile || die("\nBad .inflectrc file ($rcfile):\n\t$@\n"))
!ll&&!rl&&r
1400
$rcfile and -r $rcfile and -s $rcfile
!ll&&!rl&&r
1400
$rcfile and -r $rcfile
!ll&&!rl&&r
0140
do $rcfile or die "\nBad .inflectrc file ($rcfile):\n\t$@\n"
l!l
00
MC/DC0%0/4
$rcfile && -r $rcfile && -s $rcfile && (do $rcfile || die("\nBad .inflectrc file ($rcfile):\n\t$@\n"))
$rcfile -r $rcfile -s $rcfile do $rcfile
Truth table0%0/5
A and B and C && D
A= $rcfileB= -r $rcfileC= -s $rcfileD= do $rcfile
ABCDresult
0XXX0
10XX0
110X0
11100
11111
787 if $rcfile && -r $rcfile && -s $rcfile;
788 };
789  
790 sub postprocess # FIX PEDANTRY AND CAPITALIZATION :-)
791 {
792 10285 ▶my ($orig, $inflected) = @_;
Subroutine postprocess: called CC=5 SCAR=16.1
Pod undocumented
793 10285 ▶$inflected =~ s/([^|]+)\|(.+)/ $classical{all}?$2:$1 /e;
Branch: 1 branch
BranchTrueFalseTotal
$classical{'all'} ? : 96 77 173
794 10285 ▶return $orig =~ /^I$/ ? $inflected
Branch: 3 branches
BranchTrueFalseTotal
$orig =~ /^I$/u ? : 10 10275 10285
$orig =~ /^[A-Z]+$/u ? : 12 10263 10275
$orig =~ /^[A-Z]/u ? : 1148 9115 10263
795 : $orig =~ /^[A-Z]+$/ ? uc $inflected
796 : $orig =~ /^[A-Z]/ ? ucfirst $inflected
797 : $inflected;
798 }
799  
800 sub PL
801 # PL($word,$number)
802 {
803 1704 ▶my ($str, $count) = @_;
Subroutine PL: called CC=4 SCAR=14.0
Pod documented
804 1704 my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
805 1704 ▶return $str unless $word;
Branch: 1 branch
BranchTrueFalseTotal
unless $word 0 1704 1704
806 1704 ▶my $plural = postprocess $word, _PL_special_adjective($word,$count)
Condition83%5/6
_PL_special_adjective($word, $count) || _PL_special_verb($word, $count) || _PL_noun($word, $count)
l!l&&r!l&&!r
19715070
_PL_special_adjective($word, $count) or _PL_special_verb($word, $count)
l!l&&r!l&&!r
471501507
MC/DC0%0/3
_PL_special_adjective($word, $count) || _PL_special_verb($word, $count) || _PL_noun($word, $count)
_PL_special_adjective($word, $count) _PL_special_verb($word, $count) _PL_noun($word, $count)
Truth table75%3/4
A or B || C
A= _PL_special_adjective($word, $count)B= _PL_special_verb($word, $count)C= _PL_noun($word, $count)
ABCresult
1XX1
01X1
0011
0000
807 || _PL_special_verb($word,$count)
808 || _PL_noun($word,$count);
809 1704 return $pre.$plural.$post;
810 }
811  
812 sub PL_N
813 # PL_N($word,$number)
814 {
815 6553 ▶my ($str, $count) = @_;
Subroutine PL_N: called CC=2 SCAR=7.0
Pod documented
816 6553 my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
817 6553 ▶return $str unless $word;
Branch: 1 branch
BranchTrueFalseTotal
unless $word 0 6553 6553
818 6553 my $plural = postprocess $word, _PL_noun($word,$count);
819 6553 return $pre.$plural.$post;
820 }
821  
822 sub PL_V
823 # PL_V($word,$number)
824 {
825 2028 ▶my ($str, $count) = @_;
Subroutine PL_V: called CC=3 SCAR=11.2
Pod documented
826 2028 my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
827 2028 ▶return $str unless $word;
Branch: 1 branch
BranchTrueFalseTotal
unless $word 0 2028 2028
828 2028 ▶my $plural = postprocess $word, _PL_special_verb($word,$count)
Condition66%2/3
_PL_special_verb($word, $count) || _PL_general_verb($word, $count)
l!l&&r!l&&!r
37416540
MC/DC0%0/2
_PL_special_verb($word, $count) || _PL_general_verb($word, $count)
_PL_special_verb($word, $count) _PL_general_verb($word, $count)
Truth table66%2/3
A || B
A= _PL_special_verb($word, $count)B= _PL_general_verb($word, $count)
ABresult
1X1
011
000
829 || _PL_general_verb($word,$count);
830 2028 return $pre.$plural.$post;
831 }
832  
833 sub PL_ADJ
834 # PL_ADJ($word,$number)
835 {
836 0 ▶my ($str, $count) = @_;
Subroutine PL_ADJ: not called CC=3 SCAR=24.8
Pod documented
837 0 my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
838 0 ▶return $str unless $word;
Branch: 1 branch
BranchTrueFalseTotal
unless $word 0 0 0
839 0 ▶my $plural = postprocess $word, _PL_special_adjective($word,$count)
Condition0%0/3
_PL_special_adjective($word, $count) || $word
l!l&&r!l&&!r
000
MC/DC0%0/2
_PL_special_adjective($word, $count) || $word
_PL_special_adjective($word, $count) $word
Truth table0%0/3
A || B
A= _PL_special_adjective($word, $count)B= $word
ABresult
1X1
011
000
840 || $word;
841 0 return $pre.$plural.$post;
842 }
843  
844 3384 ▶sub PL_eq { _PL_eq(@_, \&PL_N) || _PL_eq(@_, \&PL_V) || \&PL_ADJ; }
Subroutine PL_eq: called CC=3 SCAR=11.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
_PL_eq(@_, \&Lingua::ENG::Inflect::PL_N) or _PL_eq(@_, \&Lingua::ENG::Inflect::PL_V) or \&Lingua::ENG::Inflect::PL_ADJ 60 3324 3384
Condition100%3/3
_PL_eq(@_, \&Lingua::ENG::Inflect::PL_N) or _PL_eq(@_, \&Lingua::ENG::Inflect::PL_V)
l!l&&r!l&&!r
32646060
MC/DC100%2/2
_PL_eq(@_, \&Lingua::ENG::Inflect::PL_N) or _PL_eq(@_, \&Lingua::ENG::Inflect::PL_V)
_PL_eq(@_, \&Lingua::ENG::Inflect::PL_N) _PL_eq(@_, \&Lingua::ENG::Inflect::PL_V)
Truth table100%3/3
A or B
A= _PL_eq(@_, \&Lingua::ENG::Inflect::PL_N)B= _PL_eq(@_, \&Lingua::ENG::Inflect::PL_V)
ABresult
1X1
011
000
845 0 ▶sub PL_N_eq { _PL_eq(@_, \&PL_N); }
Subroutine PL_N_eq: not called CC=1 SCAR=6.9
Pod undocumented
846 0 ▶sub PL_V_eq { _PL_eq(@_, \&PL_V); }
Subroutine PL_V_eq: not called CC=1 SCAR=6.9
Pod undocumented
847 0 ▶sub PL_ADJ_eq { _PL_eq(@_, \&PL_ADJ); }
Subroutine PL_ADJ_eq: not called CC=1 SCAR=6.9
Pod undocumented
848  
849 sub _PL_eq
850 {
851 3504 ▶my ( $word1, $word2, $PL ) = @_;
Subroutine _PL_eq: called CC=21 SCAR=32.6
852 3504 my %classval = %classical;
853 3504 %classical = %all_classical;
854 3504 my $result = "";
855 3504 ▶$result = "eq" if !$result && $word1 eq $word2;
Branch: 1 branch
BranchTrueFalseTotal
if not $result and $word1 eq $word2 894 2610 3504
Condition66%2/3
not $result and $word1 eq $word2
!ll&&!rl&&r
02610894
MC/DC50%1/2
not $result and $word1 eq $word2
not $result $word1 eq $word2
Truth table66%2/3
not(A) and B
A= not $resultB= $word1 eq $word2
ABresult
0X0
100
111
856 3504 ▶$result = "p:s" if !$result && $word1 eq &$PL($word2);
Branch: 1 branch
BranchTrueFalseTotal
if not $result and $word1 eq &$PL($word2) 1043 2461 3504
Condition100%3/3
not $result and $word1 eq &$PL($word2)
!ll&&!rl&&r
89415671043
MC/DC100%2/2
not $result and $word1 eq &$PL($word2)
not $result $word1 eq &$PL($word2)
Truth table100%3/3
not(A) and B
A= not $resultB= $word1 eq &$PL($word2)
ABresult
0X0
100
111
857 3504 ▶$result = "s:p" if !$result && &$PL($word1) eq $word2;
Branch: 1 branch
BranchTrueFalseTotal
if not $result and &$PL($word1) eq $word2 1043 2461 3504
Condition100%3/3
not $result and &$PL($word1) eq $word2
!ll&&!rl&&r
19375241043
MC/DC100%2/2
not $result and &$PL($word1) eq $word2
not $result &$PL($word1) eq $word2
Truth table100%3/3
not(A) and B
A= not $resultB= &$PL($word1) eq $word2
ABresult
0X0
100
111
858 3504 %classical = ();
859 3504 ▶$result = "p:s" if !$result && $word1 eq &$PL($word2);
Branch: 1 branch
BranchTrueFalseTotal
if not $result and $word1 eq &$PL($word2) 172 3332 3504
Condition100%3/3
not $result and $word1 eq &$PL($word2)
!ll&&!rl&&r
2980352172
MC/DC100%2/2
not $result and $word1 eq &$PL($word2)
not $result $word1 eq &$PL($word2)
Truth table100%3/3
not(A) and B
A= not $resultB= $word1 eq &$PL($word2)
ABresult
0X0
100
111
860 3504 ▶$result = "s:p" if !$result && &$PL($word1) eq $word2;
Branch: 1 branch
BranchTrueFalseTotal
if not $result and &$PL($word1) eq $word2 172 3332 3504
Condition100%3/3
not $result and &$PL($word1) eq $word2
!ll&&!rl&&r
3152180172
MC/DC100%2/2
not $result and &$PL($word1) eq $word2
not $result &$PL($word1) eq $word2
Truth table100%3/3
not(A) and B
A= not $resultB= &$PL($word1) eq $word2
ABresult
0X0
100
111
861 3504 %classical = %classval;
862  
863 3504 ▶if ($PL == \&PL || $PL == \&PL_N)
Branch: 1 branch
BranchTrueFalseTotal
if ($PL == \&Lingua::ENG::Inflect::PL or $PL == \&Lingua::ENG::Inflect::PL_N) 3384 120 3504
Condition66%2/3
$PL == \&Lingua::ENG::Inflect::PL or $PL == \&Lingua::ENG::Inflect::PL_N
l!l&&r!l&&!r
03384120
MC/DC50%1/2
$PL == \&Lingua::ENG::Inflect::PL or $PL == \&Lingua::ENG::Inflect::PL_N
$PL == \&Lingua::ENG::Inflect::PL $PL == \&Lingua::ENG::Inflect::PL_N
Truth table66%2/3
A or B
A= $PL == \&Lingua::ENG::Inflect::PLB= $PL == \&Lingua::ENG::Inflect::PL_N
ABresult
1X1
011
000
864 {
865 3384 ▶ $result = "p:p"
Branch: 1 branch
BranchTrueFalseTotal
if not $result and _PL_check_plurals_N($word1, $word2) 0 3384 3384
Condition66%2/3
not $result and _PL_check_plurals_N($word1, $word2)
!ll&&!rl&&r
32641200
MC/DC0%0/2
not $result and _PL_check_plurals_N($word1, $word2)
not $result _PL_check_plurals_N($word1, $word2)
Truth table66%2/3
not(A) and B
A= not $resultB= _PL_check_plurals_N($word1, $word2)
ABresult
0X0
100
111
866 if !$result && _PL_check_plurals_N($word1,$word2);
867 3384 ▶ $result = "p:p"
Branch: 1 branch
BranchTrueFalseTotal
if not $result and _PL_check_plurals_N($word2, $word1) 0 3384 3384
Condition66%2/3
not $result and _PL_check_plurals_N($word2, $word1)
!ll&&!rl&&r
32641200
MC/DC0%0/2
not $result and _PL_check_plurals_N($word2, $word1)
not $result _PL_check_plurals_N($word2, $word1)
Truth table66%2/3
not(A) and B
A= not $resultB= _PL_check_plurals_N($word2, $word1)
ABresult
0X0
100
111
868 if !$result && _PL_check_plurals_N($word2,$word1);
869 }
870 3504 ▶if ($PL == \&PL || $PL == \&PL_ADJ)
Branch: 1 branch
BranchTrueFalseTotal
if ($PL == \&Lingua::ENG::Inflect::PL or $PL == \&Lingua::ENG::Inflect::PL_ADJ) 0 3504 3504
Condition33%1/3
$PL == \&Lingua::ENG::Inflect::PL or $PL == \&Lingua::ENG::Inflect::PL_ADJ
l!l&&r!l&&!r
003504
MC/DC0%0/2
$PL == \&Lingua::ENG::Inflect::PL or $PL == \&Lingua::ENG::Inflect::PL_ADJ
$PL == \&Lingua::ENG::Inflect::PL $PL == \&Lingua::ENG::Inflect::PL_ADJ
Truth table33%1/3
A or B
A= $PL == \&Lingua::ENG::Inflect::PLB= $PL == \&Lingua::ENG::Inflect::PL_ADJ
ABresult
1X1
011
000
871 {
872 0 ▶ $result = "p:p"
Branch: 1 branch
BranchTrueFalseTotal
if not $result and _PL_check_plurals_ADJ($word1, $word2, $PL) 0 0 0
Condition0%0/3
not $result and _PL_check_plurals_ADJ($word1, $word2, $PL)
!ll&&!rl&&r
000
MC/DC0%0/2
not $result and _PL_check_plurals_ADJ($word1, $word2, $PL)
not $result _PL_check_plurals_ADJ($word1, $word2, $PL)
Truth table0%0/3
not(A) and B
A= not $resultB= _PL_check_plurals_ADJ($word1, $word2, $PL)
ABresult
0X0
100
111
873 if !$result && _PL_check_plurals_ADJ($word1,$word2,$PL);
874 }
875  
876 3504 return $result;
877 }
878  
879 sub _PL_reg_plurals
880 {
881 3840 ▶ $_[0] =~ /($_[1])($_[2]\|\1$_[3]|$_[3]\|\1$_[2])/
Subroutine _PL_reg_plurals: called CC=1 SCAR=0.0
882 }
883  
884 sub _PL_check_plurals_N
885 {
886 240 ▶my $pair = "$_[0]|$_[1]";
Subroutine _PL_check_plurals_N: called CC=21 SCAR=46.3
887 240 ▶foreach ( values %PL_sb_irregular_s ) { return 1 if $_ eq $pair; }
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $pair 0 1920 1920
888 240 ▶foreach ( values %PL_sb_irregular ) { return 1 if $_ eq $pair; }
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $pair 0 10320 10320
889  
890 240 ▶return 1 if _PL_reg_plurals($pair, $PL_sb_C_a_ata, "as","ata")
Branch: 1 branch
BranchTrueFalseTotal
if _PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") or _PL_reg_plurals($pair, ".*eau", "s", "x") or _PL_reg_plurals($pair, ".*ieu", "s", "x") or _PL_reg_plurals($pair, ".*tri", "xes", "ces") or _PL_reg_plurals($pair, ".{2,}[yia]n", "xes", "ges") 0 240 240
Condition33%15/45
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") or _PL_reg_plurals($pair, ".*eau", "s", "x") or _PL_reg_plurals($pair, ".*ieu", "s", "x") or _PL_reg_plurals($pair, ".*tri", "xes", "ces") or _PL_reg_plurals($pair, ".{2,}[yia]n", "xes", "ges")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") or _PL_reg_plurals($pair, ".*eau", "s", "x") or _PL_reg_plurals($pair, ".*ieu", "s", "x") or _PL_reg_plurals($pair, ".*tri", "xes", "ces")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") or _PL_reg_plurals($pair, ".*eau", "s", "x") or _PL_reg_plurals($pair, ".*ieu", "s", "x")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") or _PL_reg_plurals($pair, ".*eau", "s", "x")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e")
l!l&&r!l&&!r
00240
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides")
l!l&&r!l&&!r
00240
MC/DC0%0/16
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") or _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") or _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") or _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") or _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") or _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") or _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") or _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") or _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") or _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") or _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") or _PL_reg_plurals($pair, ".*eau", "s", "x") or _PL_reg_plurals($pair, ".*ieu", "s", "x") or _PL_reg_plurals($pair, ".*tri", "xes", "ces") or _PL_reg_plurals($pair, ".{2,}[yia]n", "xes", "ges")
_PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata") _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides") _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e") _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina") _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a") _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i") _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a") _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i") _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices") _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices") _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i") _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im") _PL_reg_plurals($pair, ".*eau", "s", "x") _PL_reg_plurals($pair, ".*ieu", "s", "x") _PL_reg_plurals($pair, ".*tri", "xes", "ces") _PL_reg_plurals($pair, ".{2,}[yia]n", "xes", "ges")
Truth table5%1/17
A or B or C or D or E or F or G or H or I or J or K or L or M or N or O or P
A= _PL_reg_plurals($pair, $PL_sb_C_a_ata, "as", "ata")B= _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is", "ides")C= _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s", "e")D= _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens", "ina")E= _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums", "a")F= _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses", "i")G= _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons", "a")H= _PL_reg_plurals($pair, $PL_sb_C_o_i, "os", "i")I= _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes", "ices")J= _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes", "ices")K= _PL_reg_plurals($pair, $PL_sb_C_i, "s", "i")L= _PL_reg_plurals($pair, $PL_sb_C_im, "s", "im")M= _PL_reg_plurals($pair, ".*eau", "s", "x")N= _PL_reg_plurals($pair, ".*ieu", "s", "x")O= _PL_reg_plurals($pair, ".*tri", "xes", "ces")P= _PL_reg_plurals($pair, ".{2,}[yia]n", "xes", "ges")
ABCDEFGHIJKLMNOPresult
1XXXXXXXXXXXXXXX1
01XXXXXXXXXXXXXX1
001XXXXXXXXXXXXX1
0001XXXXXXXXXXXX1
00001XXXXXXXXXXX1
000001XXXXXXXXXX1
0000001XXXXXXXXX1
00000001XXXXXXXX1
000000001XXXXXXX1
0000000001XXXXXX1
00000000001XXXXX1
000000000001XXXX1
0000000000001XXX1
00000000000001XX1
000000000000001X1
00000000000000011
00000000000000000
891 || _PL_reg_plurals($pair, $PL_sb_C_is_ides, "is","ides")
892 || _PL_reg_plurals($pair, $PL_sb_C_a_ae, "s","e")
893 || _PL_reg_plurals($pair, $PL_sb_C_en_ina, "ens","ina")
894 || _PL_reg_plurals($pair, $PL_sb_C_um_a, "ums","a")
895 || _PL_reg_plurals($pair, $PL_sb_C_us_i, "uses","i")
896 || _PL_reg_plurals($pair, $PL_sb_C_on_a, "ons","a")
897 || _PL_reg_plurals($pair, $PL_sb_C_o_i, "os","i")
898 || _PL_reg_plurals($pair, $PL_sb_C_ex_ices, "exes","ices")
899 || _PL_reg_plurals($pair, $PL_sb_C_ix_ices, "ixes","ices")
900 || _PL_reg_plurals($pair, $PL_sb_C_i, "s","i")
901 || _PL_reg_plurals($pair, $PL_sb_C_im, "s","im")
902  
903 || _PL_reg_plurals($pair, '.*eau', "s","x")
904 || _PL_reg_plurals($pair, '.*ieu', "s","x")
905 || _PL_reg_plurals($pair, '.*tri', "xes","ces")
906 || _PL_reg_plurals($pair, '.{2,}[yia]n', "xes","ges");
907  
908 240 return 0;
909 }
910  
911 sub _PL_check_plurals_ADJ
912 {
913 0 ▶my ( $word1a, $word2a ) = @_;
Subroutine _PL_check_plurals_ADJ: not called CC=19 SCAR=59.4
914 0 my ( $word1b, $word2b ) = @_;
915  
916 0 ▶$word1a = '' unless $word1a =~ s/'s?$//;
Branch: 1 branch
BranchTrueFalseTotal
unless $word1a =~ s/'s?$//u 0 0 0
917 0 ▶$word2a = '' unless $word2a =~ s/'s?$//;
Branch: 1 branch
BranchTrueFalseTotal
unless $word2a =~ s/'s?$//u 0 0 0
918 0 ▶$word1b = '' unless $word1b =~ s/s'$//;
Branch: 1 branch
BranchTrueFalseTotal
unless $word1b =~ s/s'$//u 0 0 0
919 0 ▶$word2b = '' unless $word2b =~ s/s'$//;
Branch: 1 branch
BranchTrueFalseTotal
unless $word2b =~ s/s'$//u 0 0 0
920  
921 0 ▶if ($word1a)
Branch: 1 branch
BranchTrueFalseTotal
if ($word1a) 0 0 0
922 {
923 0 ▶ return 1 if $word2a && ( _PL_check_plurals_N($word1a, $word2a)
Branch: 1 branch
BranchTrueFalseTotal
if $word2a and _PL_check_plurals_N($word1a, $word2a) || _PL_check_plurals_N($word2a, $word1a) 0 0 0
Condition0%0/6
$word2a and _PL_check_plurals_N($word1a, $word2a) || _PL_check_plurals_N($word2a, $word1a)
!ll&&!rl&&r
000
_PL_check_plurals_N($word1a, $word2a) or _PL_check_plurals_N($word2a, $word1a)
l!l&&r!l&&!r
000
MC/DC0%0/3
$word2a and _PL_check_plurals_N($word1a, $word2a) || _PL_check_plurals_N($word2a, $word1a)
$word2a _PL_check_plurals_N($word1a, $word2a) _PL_check_plurals_N($word2a, $word1a)
Truth table0%0/4
A and B or C
A= $word2aB= _PL_check_plurals_N($word1a, $word2a)C= _PL_check_plurals_N($word2a, $word1a)
ABCresult
0XX0
1000
11X1
1011
924 || _PL_check_plurals_N($word2a, $word1a) );
925 0 ▶ return 1 if $word2b && ( _PL_check_plurals_N($word1a, $word2b)
Branch: 1 branch
BranchTrueFalseTotal
if $word2b and _PL_check_plurals_N($word1a, $word2b) || _PL_check_plurals_N($word2b, $word1a) 0 0 0
Condition0%0/6
$word2b and _PL_check_plurals_N($word1a, $word2b) || _PL_check_plurals_N($word2b, $word1a)
!ll&&!rl&&r
000
_PL_check_plurals_N($word1a, $word2b) or _PL_check_plurals_N($word2b, $word1a)
l!l&&r!l&&!r
000
MC/DC0%0/3
$word2b and _PL_check_plurals_N($word1a, $word2b) || _PL_check_plurals_N($word2b, $word1a)
$word2b _PL_check_plurals_N($word1a, $word2b) _PL_check_plurals_N($word2b, $word1a)
Truth table0%0/4
A and B or C
A= $word2bB= _PL_check_plurals_N($word1a, $word2b)C= _PL_check_plurals_N($word2b, $word1a)
ABCresult
0XX0
1000
11X1
1011
926 || _PL_check_plurals_N($word2b, $word1a) );
927 }
928 0 ▶if ($word1b)
Branch: 1 branch
BranchTrueFalseTotal
if ($word1b) 0 0 0
929 {
930 0 ▶ return 1 if $word2a && ( _PL_check_plurals_N($word1b, $word2a)
Branch: 1 branch
BranchTrueFalseTotal
if $word2a and _PL_check_plurals_N($word1b, $word2a) || _PL_check_plurals_N($word2a, $word1b) 0 0 0
Condition0%0/6
$word2a and _PL_check_plurals_N($word1b, $word2a) || _PL_check_plurals_N($word2a, $word1b)
!ll&&!rl&&r
000
_PL_check_plurals_N($word1b, $word2a) or _PL_check_plurals_N($word2a, $word1b)
l!l&&r!l&&!r
000
MC/DC0%0/3
$word2a and _PL_check_plurals_N($word1b, $word2a) || _PL_check_plurals_N($word2a, $word1b)
$word2a _PL_check_plurals_N($word1b, $word2a) _PL_check_plurals_N($word2a, $word1b)
Truth table0%0/4
A and B or C
A= $word2aB= _PL_check_plurals_N($word1b, $word2a)C= _PL_check_plurals_N($word2a, $word1b)
ABCresult
0XX0
1000
11X1
1011
931 || _PL_check_plurals_N($word2a, $word1b) );
932 0 ▶ return 1 if $word2b && ( _PL_check_plurals_N($word1b, $word2b)
Branch: 1 branch
BranchTrueFalseTotal
if $word2b and _PL_check_plurals_N($word1b, $word2b) || _PL_check_plurals_N($word2b, $word1b) 0 0 0
Condition0%0/6
$word2b and _PL_check_plurals_N($word1b, $word2b) || _PL_check_plurals_N($word2b, $word1b)
!ll&&!rl&&r
000
_PL_check_plurals_N($word1b, $word2b) or _PL_check_plurals_N($word2b, $word1b)
l!l&&r!l&&!r
000
MC/DC0%0/3
$word2b and _PL_check_plurals_N($word1b, $word2b) || _PL_check_plurals_N($word2b, $word1b)
$word2b _PL_check_plurals_N($word1b, $word2b) _PL_check_plurals_N($word2b, $word1b)
Truth table0%0/4
A and B or C
A= $word2bB= _PL_check_plurals_N($word1b, $word2b)C= _PL_check_plurals_N($word2b, $word1b)
ABCresult
0XX0
1000
11X1
1011
933 || _PL_check_plurals_N($word2b, $word1b) );
934 }
935  
936 0 return "";
937 }
938  
939 sub _PL_noun
940 {
941 8256 ▶my ( $word, $count ) = @_;
Subroutine _PL_noun: called CC=78 SCAR=43.6
942 8256 my $value; # UTILITY VARIABLE
943  
944 # DEFAULT TO PLURAL
945  
946 8256 ▶$count = $persistent_count
Branch: 1 branch
BranchTrueFalseTotal
if not defined $count and defined $persistent_count 0 8256 8256
Condition66%2/3
not defined $count and defined $persistent_count
!ll&&!rl&&r
21480420
MC/DC0%0/2
not defined $count and defined $persistent_count
not defined $count defined $persistent_count
Truth table66%2/3
not(A) and B
A= not defined $countB= defined $persistent_count
ABresult
0X0
100
111
947 if !defined($count) && defined($persistent_count);
948  
949 $count = (defined $count and $count=~/^($PL_count_one)$/io
950 or defined $count and $classical{zero}
951 8256 ▶ and $count=~/^($PL_count_zero)$/io)
Branch: 1 branch
BranchTrueFalseTotal
defined $count && $count =~ /^($PL_count_one)$/iou || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/iou ? : 6 8250 8256
Condition83%10/12
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
l!l&&r!l&&!r
068250
defined $count and $count =~ /^($PL_count_one)$/iou
!ll&&!rl&&r
80422140
defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
!ll&&!rl&&r
81061446
defined $count and $classical{"zero"}
!ll&&!rl&&r
804264150
MC/DC80%4/5
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
defined $count $count =~ /^($PL_count_one)$/iou defined $count $classical{"zero"} $count =~ /^($PL_count_zero)$/iou
Truth table44%4/9
A and B or C and D and E
A= defined $countB= $count =~ /^($PL_count_one)$/iouC= defined $countD= $classical{"zero"}E= $count =~ /^($PL_count_zero)$/iou
ABCDEresult
11XXX1
0X1111
101111
0X0XX0
0X10X0
0X1100
100XX0
1010X0
101100
952 ? 1
953 : 2;
954  
955 8256 ▶return $word if $count==1;
Branch: 1 branch
BranchTrueFalseTotal
if $count == 1 6 8250 8256
956  
957 # HANDLE USER-DEFINED NOUNS
958  
959 8250 ▶return $value if defined($value = ud_match($word, @PL_sb_user_defined));
Branch: 1 branch
BranchTrueFalseTotal
if defined($value = ud_match($word, @PL_sb_user_defined)) 3 8247 8250
960  
961 # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
962  
963 8247 ▶$word eq '' and return $word;
Branch: 1 branch
BranchTrueFalseTotal
$word eq "" and return $word 0 8247 8247
964  
965 8247 ▶$word =~ /^($PL_sb_uninflected)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_sb_uninflected)$/iu and return $word 714 7533 8247
966 and return $word;
967  
968 7533 ▶$classical{herd} and $word =~ /^($PL_sb_uninflected_herd)$/i
Branch: 1 branch
BranchTrueFalseTotal
$classical{"herd"} and $word =~ /^($PL_sb_uninflected_herd)$/iu and return $word 42 7491 7533
Condition100%3/3
$classical{"herd"} and $word =~ /^($PL_sb_uninflected_herd)$/iu
!ll&&!rl&&r
2139535242
MC/DC100%2/2
$classical{"herd"} and $word =~ /^($PL_sb_uninflected_herd)$/iu
$classical{"herd"} $word =~ /^($PL_sb_uninflected_herd)$/iu
Truth table100%3/3
A and B
A= $classical{"herd"}B= $word =~ /^($PL_sb_uninflected_herd)$/iu
ABresult
0X0
100
111
969 and return $word;
970  
971 # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
972  
973 7491 ▶$word =~ /^(?:$PL_sb_postfix_adj)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(?:$PL_sb_postfix_adj)$/iu and $value = $2 and return _PL_noun($1, 2) . $value 58 7433 7491
Condition66%2/3
$word =~ /^(?:$PL_sb_postfix_adj)$/iu and $value = $2
!ll&&!rl&&r
7433058
MC/DC50%1/2
$word =~ /^(?:$PL_sb_postfix_adj)$/iu and $value = $2
$word =~ /^(?:$PL_sb_postfix_adj)$/iu $value = $2
Truth table66%2/3
A and B
A= $word =~ /^(?:$PL_sb_postfix_adj)$/iuB= $value = $2
ABresult
0X0
100
111
974 and $value = $2
975 and return _PL_noun($1,2)
976 . $value;
977  
978 7433 ▶$word =~ /^(?:$PL_sb_prep_dual_compound)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(?:$PL_sb_prep_dual_compound)$/iu and $value = [$2, $3] and return _PL_noun($1, 2) . $value->[0] . _PL_noun($value->[1]) 8 7425 7433
Condition100%2/2
$word =~ /^(?:$PL_sb_prep_dual_compound)$/iu and $value = [$2, $3]
!ll
74258
MC/DC100%1/1
$word =~ /^(?:$PL_sb_prep_dual_compound)$/iu and $value = [$2, $3]
$word =~ /^(?:$PL_sb_prep_dual_compound)$/iu
Truth table100%2/2
A
A= $word =~ /^(?:$PL_sb_prep_dual_compound)$/iu
Aresult
00
11
979 and $value = [$2,$3]
980 and return _PL_noun($1,2)
981 . $value->[0]
982 . _PL_noun($value->[1]);
983  
984 7425 ▶$word =~ /^(?:$PL_sb_prep_compound)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(?:$PL_sb_prep_compound)$/iu and $value = $2 and return _PL_noun($1, 2) . $value 122 7303 7425
Condition66%2/3
$word =~ /^(?:$PL_sb_prep_compound)$/iu and $value = $2
!ll&&!rl&&r
73030122
MC/DC50%1/2
$word =~ /^(?:$PL_sb_prep_compound)$/iu and $value = $2
$word =~ /^(?:$PL_sb_prep_compound)$/iu $value = $2
Truth table66%2/3
A and B
A= $word =~ /^(?:$PL_sb_prep_compound)$/iuB= $value = $2
ABresult
0X0
100
111
985 and $value = $2
986 and return _PL_noun($1,2)
987 . $value;
988  
989 # HANDLE PRONOUNS
990  
991 $word =~ /^((?:$PL_prep)\s+)($PL_pron_acc)$/i
992 7303 ▶ and return $1.$PL_pron_acc{lc($2)};
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^((?:$PL_prep)\s+)($PL_pron_acc)$/iu and return $1 . $PL_pron_acc{lc $2} 184 7119 7303
993  
994 7119 ▶$value = $PL_pron_nom{lc($word)}
Branch: 1 branch
BranchTrueFalseTotal
$value = $PL_pron_nom{lc $word} and return $value 130 6989 7119
995 and return $value;
996  
997 $word =~ /^($PL_pron_acc)$/i
998 6989 ▶ and return $PL_pron_acc{lc($1)};
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_pron_acc)$/iu and return $PL_pron_acc{lc $1} 28 6961 6989
999  
1000 # HANDLE ISOLATED IRREGULAR PLURALS
1001  
1002 $word =~ /(.*)\b($PL_sb_irregular)$/i
1003 and return $1
1004 6961 ▶ . ( $PL_sb_irregular{$2} || $PL_sb_irregular{lc $2} );
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)\b($PL_sb_irregular)$/iu and return $1 . ($PL_sb_irregular{$2} || $PL_sb_irregular{lc $2}) 332 6629 6961
Condition33%1/3
$PL_sb_irregular{$2} || $PL_sb_irregular{lc $2}
l!l&&r!l&&!r
33200
MC/DC0%0/2
$PL_sb_irregular{$2} || $PL_sb_irregular{lc $2}
$PL_sb_irregular{$2} $PL_sb_irregular{lc $2}
Truth table33%1/3
A || B
A= $PL_sb_irregular{$2}B= $PL_sb_irregular{lc $2}
ABresult
1X1
011
000
1005 6629 ▶$word =~ /($PL_sb_U_man_mans)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_man_mans)$/iu and return "$1s" 264 6365 6629
1006 and return "$1s";
1007 6365 ▶$word =~ /(\S*)quy$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(\S*)quy$/iu and return "$1quies" 8 6357 6365
1008 and return "$1quies";
1009 6357 ▶$word =~ /(\S*)(person)$/i and return $classical{persons}?"$1persons":"$1people";
Branch: 2 branches
BranchTrueFalseTotal
$word =~ /(\S*)(person)$/iu and return $classical{"persons"} ? "$1persons" : "$1people" 40 6317 6357
$classical{'persons'} ? : 18 22 40
1010  
1011 # HANDLE FAMILIES OF IRREGULAR PLURALS
1012  
1013 6317 ▶$word =~ /(.*)man$/i and return "$1men";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)man$/iu and return "$1men" 162 6155 6317
1014 6155 ▶$word =~ /(.*[ml])ouse$/i and return "$1ice";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*[ml])ouse$/iu and return "$1ice" 48 6107 6155
1015 6107 ▶$word =~ /(.*)goose$/i and return "$1geese";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)goose$/iu and return "$1geese" 8 6099 6107
1016 6099 ▶$word =~ /(.*)tooth$/i and return "$1teeth";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)tooth$/iu and return "$1teeth" 8 6091 6099
1017 6091 ▶$word =~ /(.*)foot$/i and return "$1feet";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)foot$/iu and return "$1feet" 10 6081 6091
1018  
1019 # HANDLE UNASSIMILATED IMPORTS
1020  
1021 6081 ▶$word =~ /(.*)ceps$/i and return $word;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)ceps$/iu and return $word 4 6077 6081
1022 6077 ▶$word =~ /(.*)zoon$/i and return "$1zoa";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)zoon$/iu and return "$1zoa" 24 6053 6077
1023 6053 ▶$word =~ /(.*[csx])is$/i and return "$1es";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*[csx])is$/iu and return "$1es" 32 6021 6053
1024 6021 ▶$word =~ /($PL_sb_U_ch_chs)ch$/i and return "$1chs";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_ch_chs)ch$/iu and return "$1chs" 24 5997 6021
1025 5997 ▶$word =~ /($PL_sb_U_ex_ices)ex$/i and return "$1ices";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_ex_ices)ex$/iu and return "$1ices" 24 5973 5997
1026 5973 ▶$word =~ /($PL_sb_U_ix_ices)ix$/i and return "$1ices";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_ix_ices)ix$/iu and return "$1ices" 16 5957 5973
1027 5957 ▶$word =~ /($PL_sb_U_um_a)um$/i and return "$1a";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_um_a)um$/iu and return "$1a" 72 5885 5957
1028 5885 ▶$word =~ /($PL_sb_U_us_i)us$/i and return "$1i";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_us_i)us$/iu and return "$1i" 72 5813 5885
1029 5813 ▶$word =~ /($PL_sb_U_on_a)on$/i and return "$1a";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_on_a)on$/iu and return "$1a" 72 5741 5813
1030 5741 ▶$word =~ /($PL_sb_U_a_ae)$/i and return "$1e";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_U_a_ae)$/iu and return "$1e" 32 5709 5741
1031  
1032 # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
1033  
1034 5709 ▶if ($classical{ancient})
Branch: 1 branch
BranchTrueFalseTotal
if ($classical{"ancient"}) 4060 1649 5709
1035 {
1036 4060 ▶ $word =~ /(.*)trix$/i and return "$1trices";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)trix$/iu and return "$1trices" 31 4029 4060
1037 4029 ▶ $word =~ /(.*)eau$/i and return "$1eaux";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)eau$/iu and return "$1eaux" 54 3975 4029
1038 3975 ▶ $word =~ /(.*)ieu$/i and return "$1ieux";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)ieu$/iu and return "$1ieux" 12 3963 3975
1039 3963 ▶ $word =~ /(.{2,}[yia])nx$/i and return "$1nges";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.{2,}[yia])nx$/iu and return "$1nges" 24 3939 3963
1040 3939 ▶ $word =~ /($PL_sb_C_en_ina)en$/i and return "$1ina";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_en_ina)en$/iu and return "$1ina" 24 3915 3939
1041 3915 ▶ $word =~ /($PL_sb_C_ex_ices)ex$/i and return "$1ices";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_ex_ices)ex$/iu and return "$1ices" 49 3866 3915
1042 3866 ▶ $word =~ /($PL_sb_C_ix_ices)ix$/i and return "$1ices";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_ix_ices)ix$/iu and return "$1ices" 6 3860 3866
1043 3860 ▶ $word =~ /($PL_sb_C_um_a)um$/i and return "$1a";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_um_a)um$/iu and return "$1a" 169 3691 3860
1044 3691 ▶ $word =~ /($PL_sb_C_us_i)us$/i and return "$1i";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_us_i)us$/iu and return "$1i" 84 3607 3691
1045 3607 ▶ $word =~ /($PL_sb_C_us_us)$/i and return "$1";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_us_us)$/iu and return "$1" 28 3579 3607
1046 3579 ▶ $word =~ /($PL_sb_C_a_ae)$/i and return "$1e";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_a_ae)$/iu and return "$1e" 102 3477 3579
1047 3477 ▶ $word =~ /($PL_sb_C_a_ata)a$/i and return "$1ata";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_a_ata)a$/iu and return "$1ata" 132 3345 3477
1048 3345 ▶ $word =~ /($PL_sb_C_is_ides)is$/i and return "$1ides";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_is_ides)is$/iu and return "$1ides" 66 3279 3345
1049 3279 ▶ $word =~ /($PL_sb_C_o_i)o$/i and return "$1i";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_o_i)o$/iu and return "$1i" 48 3231 3279
1050 3231 ▶ $word =~ /($PL_sb_C_on_a)on$/i and return "$1a";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_sb_C_on_a)on$/iu and return "$1a" 6 3225 3231
1051 3225 ▶ $word =~ /$PL_sb_C_im$/i and return "${word}im";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /$PL_sb_C_im$/iu and return "${word}im" 18 3207 3225
1052 3207 ▶ $word =~ /$PL_sb_C_i$/i and return "${word}i";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /$PL_sb_C_i$/iu and return "${word}i" 12 3195 3207
1053 }
1054  
1055 # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
1056  
1057 4844 ▶$word =~ /^($PL_sb_singular_s)$/i and return "$1es";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_sb_singular_s)$/iu and return "$1es" 1338 3506 4844
1058 3506 ▶$word =~ /^([A-Z].*s)$/ and $classical{names} and return "$1es";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^([A-Z].*s)$/u and $classical{"names"} and return "$1es" 60 3446 3506
Condition66%2/3
$word =~ /^([A-Z].*s)$/u and $classical{"names"}
!ll&&!rl&&r
3446060
MC/DC50%1/2
$word =~ /^([A-Z].*s)$/u and $classical{"names"}
$word =~ /^([A-Z].*s)$/u $classical{"names"}
Truth table66%2/3
A and B
A= $word =~ /^([A-Z].*s)$/uB= $classical{"names"}
ABresult
0X0
100
111
1059 3446 ▶$word =~ /^(.*[^z])(z)$/i and return "$1zzes";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(.*[^z])(z)$/iu and return "$1zzes" 16 3430 3446
1060 3430 ▶$word =~ /^(.*)([cs]h|x|zz|ss)$/i and return "$1$2es";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(.*)([cs]h|x|zz|ss)$/iu and return "$1$2es" 229 3201 3430
1061 # $word =~ /(.*)(us)$/i and return "$1$2es";
1062  
1063 # HANDLE ...f -> ...ves
1064  
1065 3201 ▶$word =~ /(.*[eao])lf$/i and return "$1lves";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*[eao])lf$/iu and return "$1lves" 56 3145 3201
1066 3145 ▶$word =~ /(.*[^d])eaf$/i and return "$1eaves";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*[^d])eaf$/iu and return "$1eaves" 28 3117 3145
1067 3117 ▶$word =~ /(.*[nlw])ife$/i and return "$1ives";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*[nlw])ife$/iu and return "$1ives" 44 3073 3117
1068 3073 ▶$word =~ /(.*)arf$/i and return "$1arves";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)arf$/iu and return "$1arves" 24 3049 3073
1069  
1070 # HANDLE ...y
1071  
1072 3049 ▶$word =~ /(.*[aeiou])y$/i and return "$1ys";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*[aeiou])y$/iu and return "$1ys" 60 2989 3049
1073 2989 ▶$word =~ /([A-Z].*y)$/ and $classical{names} and return "$1s";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /([A-Z].*y)$/u and $classical{"names"} and return "$1s" 17 2972 2989
Condition100%3/3
$word =~ /([A-Z].*y)$/u and $classical{"names"}
!ll&&!rl&&r
2968417
MC/DC100%2/2
$word =~ /([A-Z].*y)$/u and $classical{"names"}
$word =~ /([A-Z].*y)$/u $classical{"names"}
Truth table100%3/3
A and B
A= $word =~ /([A-Z].*y)$/uB= $classical{"names"}
ABresult
0X0
100
111
1074 2972 ▶$word =~ /(.*)y$/i and return "$1ies";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /(.*)y$/iu and return "$1ies" 62 2910 2972
1075  
1076 # HANDLE ...o
1077  
1078 2910 ▶$word =~ /$PL_sb_U_o_os$/i and return "${word}s";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /$PL_sb_U_o_os$/iu and return "${word}s" 272 2638 2910
1079 2638 ▶$word =~ /[aeiou]o$/i and return "${word}s";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /[aeiou]o$/iu and return "${word}s" 72 2566 2638
1080 2566 ▶$word =~ /o$/i and return "${word}es";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /o$/iu and return "${word}es" 88 2478 2566
1081  
1082 # OTHERWISE JUST ADD ...s
1083  
1084 2478 return "${word}s";
1085 }
1086  
1087 sub _PL_special_verb
1088 {
1089 3685 ▶my ( $word, $count ) = @_;
Subroutine _PL_special_verb: called CC=21 SCAR=31.0
1090 3685 ▶$count = $persistent_count
Branch: 1 branch
BranchTrueFalseTotal
if not defined $count and defined $persistent_count 0 3685 3685
Condition66%2/3
not defined $count and defined $persistent_count
!ll&&!rl&&r
1136740
MC/DC0%0/2
not defined $count and defined $persistent_count
not defined $count defined $persistent_count
Truth table66%2/3
not(A) and B
A= not defined $countB= defined $persistent_count
ABresult
0X0
100
111
1091 if !defined($count) && defined($persistent_count);
1092 $count = (defined $count and $count=~/^($PL_count_one)$/io or
1093 3685 ▶ defined $count and $classical{zero} and $count=~/^($PL_count_zero)$/io) ? 1
Branch: 1 branch
BranchTrueFalseTotal
defined $count && $count =~ /^($PL_count_one)$/iou || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/iou ? : 0 3685 3685
Condition66%8/12
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
l!l&&r!l&&!r
003685
defined $count and $count =~ /^($PL_count_one)$/iou
!ll&&!rl&&r
3674110
defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
!ll&&!rl&&r
367960
defined $count and $classical{"zero"}
!ll&&!rl&&r
367456
MC/DC0%0/5
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
defined $count $count =~ /^($PL_count_one)$/iou defined $count $classical{"zero"} $count =~ /^($PL_count_zero)$/iou
Truth table33%3/9
A and B or C and D and E
A= defined $countB= $count =~ /^($PL_count_one)$/iouC= defined $countD= $classical{"zero"}E= $count =~ /^($PL_count_zero)$/iou
ABCDEresult
11XXX1
0X1111
101111
0X0XX0
0X10X0
0X1100
100XX0
1010X0
101100
1094 : 2;
1095  
1096 3685 ▶return if $count=~/^($PL_count_one)$/io;
Branch: 1 branch
BranchTrueFalseTotal
if $count =~ /^($PL_count_one)$/iou 0 3685 3685
1097  
1098 3685 my $value; # UTILITY VARIABLE
1099  
1100 # HANDLE USER-DEFINED VERBS
1101  
1102 3685 ▶return $value if defined($value = ud_match($word, @PL_v_user_defined));
Branch: 1 branch
BranchTrueFalseTotal
if defined($value = ud_match($word, @PL_v_user_defined)) 2 3683 3685
1103  
1104 # HANDLE IRREGULAR PRESENT TENSE (SIMPLE AND COMPOUND)
1105  
1106 $word =~ /^($PL_v_irregular_pres)((\s.*)?)$/i
1107 3683 ▶ and return $PL_v_irregular_pres{lc $1}.$2;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_v_irregular_pres)((\s.*)?)$/iu and return $PL_v_irregular_pres{lc $1} . $2 128 3555 3683
1108  
1109 # HANDLE IRREGULAR FUTURE, PRETERITE AND PERFECT TENSES
1110  
1111 3555 ▶$word =~ /^($PL_v_irregular_non_pres)((\s.*)?)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_v_irregular_non_pres)((\s.*)?)$/iu and return $word 60 3495 3555
1112 and return $word;
1113  
1114 # HANDLE PRESENT NEGATIONS (SIMPLE AND COMPOUND)
1115  
1116 $word =~ /^($PL_v_irregular_pres)(n't(\s.*)?)$/i
1117 3495 ▶ and return $PL_v_irregular_pres{lc $1}.$2;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_v_irregular_pres)(n't(\s.*)?)$/iu and return $PL_v_irregular_pres{lc $1} . $2 30 3465 3495
1118  
1119 3465 ▶$word =~ /^\S+n't\b/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^\S+n't\b/iu and return $word 8 3457 3465
1120 and return $word;
1121  
1122 # HANDLE SPECIAL CASES
1123  
1124 3457 ▶$word =~ /^($PL_v_special_s)$/ and return;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_v_special_s)$/u and return 616 2841 3457
1125 2841 ▶$word =~ /\s/ and return;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /\s/u and return 152 2689 2841
1126  
1127 # HANDLE STANDARD 3RD PERSON (CHOP THE ...(e)s OFF SINGLE WORDS)
1128  
1129 2689 ▶$word =~ /^(.*)([cs]h|[x]|zz|ss)es$/i and return "$1$2";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(.*)([cs]h|[x]|zz|ss)es$/iu and return "$1$2" 16 2673 2689
1130  
1131 2673 ▶$word =~ /^(..+)ies$/i and return "$1y";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(..+)ies$/iu and return "$1y" 9 2664 2673
1132  
1133 2664 ▶$word =~ /($PL_v_oes_oe)$/ and return substr($1,0,-1);
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /($PL_v_oes_oe)$/u and return substr($1, 0, -1) 96 2568 2664
1134 2568 ▶$word =~ /^(.+)oes$/i and return "$1o";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(.+)oes$/iu and return "$1o" 0 2568 2568
1135  
1136 2568 ▶$word =~ /^(.*[^s])s$/i and return $1;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(.*[^s])s$/iu and return $1 175 2393 2568
1137  
1138 # OTHERWISE, A REGULAR VERB (HANDLE ELSEWHERE)
1139  
1140 2393 return;
1141 }
1142  
1143 sub _PL_general_verb
1144 {
1145 1654 ▶my ( $word, $count ) = @_;
Subroutine _PL_general_verb: called CC=11 SCAR=29.5
1146 1654 ▶$count = $persistent_count
Branch: 1 branch
BranchTrueFalseTotal
if not defined $count and defined $persistent_count 0 1654 1654
Condition33%1/3
not defined $count and defined $persistent_count
!ll&&!rl&&r
016540
MC/DC0%0/2
not defined $count and defined $persistent_count
not defined $count defined $persistent_count
Truth table33%1/3
not(A) and B
A= not defined $countB= defined $persistent_count
ABresult
0X0
100
111
1147 if !defined($count) && defined($persistent_count);
1148 $count = (defined $count and $count=~/^($PL_count_one)$/io or
1149 1654 ▶ defined $count and $classical{zero} and $count=~/^($PL_count_zero)$/io) ? 1
Branch: 1 branch
BranchTrueFalseTotal
defined $count && $count =~ /^($PL_count_one)$/iou || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/iou ? : 0 1654 1654
Condition33%4/12
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
l!l&&r!l&&!r
001654
defined $count and $count =~ /^($PL_count_one)$/iou
!ll&&!rl&&r
165400
defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
!ll&&!rl&&r
165400
defined $count and $classical{"zero"}
!ll&&!rl&&r
165400
MC/DC0%0/5
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
defined $count $count =~ /^($PL_count_one)$/iou defined $count $classical{"zero"} $count =~ /^($PL_count_zero)$/iou
Truth table11%1/9
A and B or C and D and E
A= defined $countB= $count =~ /^($PL_count_one)$/iouC= defined $countD= $classical{"zero"}E= $count =~ /^($PL_count_zero)$/iou
ABCDEresult
11XXX1
0X1111
101111
0X0XX0
0X10X0
0X1100
100XX0
1010X0
101100
1150 : 2;
1151  
1152 1654 ▶return $word if $count=~/^($PL_count_one)$/io;
Branch: 1 branch
BranchTrueFalseTotal
if $count =~ /^($PL_count_one)$/iou 0 1654 1654
1153  
1154 # HANDLE AMBIGUOUS PRESENT TENSES (SIMPLE AND COMPOUND)
1155  
1156 $word =~ /^($PL_v_ambiguous_pres)((\s.*)?)$/i
1157 1654 ▶ and return $PL_v_ambiguous_pres{lc $1}.$2;
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_v_ambiguous_pres)((\s.*)?)$/iu and return $PL_v_ambiguous_pres{lc $1} . $2 4 1650 1654
1158  
1159 # HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
1160  
1161 1650 ▶$word =~ /^($PL_v_ambiguous_non_pres)((\s.*)?)$/i
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_v_ambiguous_non_pres)((\s.*)?)$/iu and return $word 18 1632 1650
1162 and return $word;
1163  
1164 # OTHERWISE, 1st OR 2ND PERSON IS UNINFLECTED
1165  
1166 1632 return $word;
1167  
1168 }
1169  
1170 sub _PL_special_adjective
1171 {
1172 1704 ▶my ( $word, $count ) = @_;
Subroutine _PL_special_adjective: called CC=14 SCAR=26.4
1173 1704 ▶$count = $persistent_count
Branch: 1 branch
BranchTrueFalseTotal
if not defined $count and defined $persistent_count 0 1704 1704
Condition66%2/3
not defined $count and defined $persistent_count
!ll&&!rl&&r
1216920
MC/DC0%0/2
not defined $count and defined $persistent_count
not defined $count defined $persistent_count
Truth table66%2/3
not(A) and B
A= not defined $countB= defined $persistent_count
ABresult
0X0
100
111
1174 if !defined($count) && defined($persistent_count);
1175 $count = (defined $count and $count=~/^($PL_count_one)$/io or
1176 1704 ▶ defined $count and $classical{zero} and $count=~/^($PL_count_zero)$/io) ? 1
Branch: 1 branch
BranchTrueFalseTotal
defined $count && $count =~ /^($PL_count_one)$/iou || defined $count && $classical{'zero'} && $count =~ /^($PL_count_zero)$/iou ? : 4 1700 1704
Condition100%12/12
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
l!l&&r!l&&!r
311700
defined $count and $count =~ /^($PL_count_one)$/iou
!ll&&!rl&&r
169293
defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
!ll&&!rl&&r
169911
defined $count and $classical{"zero"}
!ll&&!rl&&r
169272
MC/DC100%5/5
defined $count and $count =~ /^($PL_count_one)$/iou or defined $count and $classical{"zero"} and $count =~ /^($PL_count_zero)$/iou
defined $count $count =~ /^($PL_count_one)$/iou defined $count $classical{"zero"} $count =~ /^($PL_count_zero)$/iou
Truth table55%5/9
A and B or C and D and E
A= defined $countB= $count =~ /^($PL_count_one)$/iouC= defined $countD= $classical{"zero"}E= $count =~ /^($PL_count_zero)$/iou
ABCDEresult
11XXX1
0X1111
101111
0X0XX0
0X10X0
0X1100
100XX0
1010X0
101100
1177 : 2;
1178  
1179 1704 ▶return $word if $count=~/^($PL_count_one)$/io;
Branch: 1 branch
BranchTrueFalseTotal
if $count =~ /^($PL_count_one)$/iou 4 1700 1704
1180  
1181 # HANDLE USER-DEFINED ADJECTIVES
1182  
1183 1700 my $value;
1184 1700 ▶return $value if defined($value = ud_match($word, @PL_adj_user_defined));
Branch: 1 branch
BranchTrueFalseTotal
if defined($value = ud_match($word, @PL_adj_user_defined)) 3 1697 1700
1185  
1186 # HANDLE KNOWN CASES
1187  
1188 $word =~ /^($PL_adj_special)$/i
1189 1697 ▶ and return $PL_adj_special{lc $1};
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_adj_special)$/iu and return $PL_adj_special{lc $1} 10 1687 1697
1190  
1191 # HANDLE POSSESSIVES
1192  
1193 $word =~ /^($PL_adj_poss)$/i
1194 1687 ▶ and return $PL_adj_poss{lc $1};
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($PL_adj_poss)$/iu and return $PL_adj_poss{lc $1} 16 1671 1687
1195  
1196 1671 ▶$word =~ /^(.*)'s?$/ and do { my $pl = PL_N($1);
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^(.*)'s?$/u and do { my $pl = PL_N($1); return "${pl}'" . ($pl =~ /s$/u ? "" : "s") } 14 1657 1671
1197 14 ▶ return "$pl'" . ($pl =~ m/s$/ ? "" : "s");
Branch: 1 branch
BranchTrueFalseTotal
$pl =~ /s$/u ? : 6 8 14
1198 };
1199  
1200 # OTHERWISE, NO IDEA
1201  
1202 1657 return;
1203  
1204 }
1205  
1206 # 2. INDEFINITE ARTICLES
1207  
1208 # THIS PATTERN MATCHES STRINGS OF CAPITALS STARTING WITH A "VOWEL-SOUND"
1209 # CONSONANT FOLLOWED BY ANOTHER CONSONANT, AND WHICH ARE NOT LIKELY
1210 # TO BE REAL WORDS (OH, ALL RIGHT THEN, IT'S JUST MAGIC!)
1211  
1212 14 my $A_abbrev = q{
1213 (?! FJO | [HLMNS]Y. | RY[EO] | SQU
1214 | ( F[LR]? | [HL] | MN? | N | RH? | S[CHKLMNPTVW]? | X(YL)?) [AEIOU])
1215 [FHLMNRSX][A-Z]
1216 };
1217  
1218 # THIS PATTERN CODES THE BEGINNINGS OF ALL ENGLISH WORDS BEGINING WITH A
1219 # 'y' FOLLOWED BY A CONSONANT. ANY OTHER Y-CONSONANT PREFIX THEREFORE
1220 # IMPLIES AN ABBREVIATION.
1221  
1222 14 my $A_y_cons = 'y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt)';
1223  
1224 # EXCEPTIONS TO EXCEPTIONS
1225  
1226 14 my $A_explicit_an = enclose join '|',
1227 (
1228 "euler",
1229 "hour(?!i)", "heir", "honest", "hono",
1230 "[fhlmnx]-?th",
1231 );
1232  
1233 sub A
1234 {
1235 109 ▶my ($str, $count) = @_;
Subroutine A: called CC=2 SCAR=7.0
Pod undocumented
1236 109 my ($pre, $word, $post) = ( $str =~ m/\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z/i );
1237 109 ▶return $str unless $word;
Branch: 1 branch
BranchTrueFalseTotal
unless $word 0 109 109
1238 109 my $result = _indef_article($word,$count);
1239 109 return $pre.$result.$post;
1240 }
1241  
1242 0 ▶sub AN { goto &A }
Subroutine AN: not called CC=1 SCAR=6.9
Pod undocumented
1243  
1244 sub _indef_article
1245 {
1246 109 ▶my ( $word, $count ) = @_;
Subroutine _indef_article: called CC=20 SCAR=32.2
1247  
1248 109 ▶$count = $persistent_count
Branch: 1 branch
BranchTrueFalseTotal
if not defined $count and defined $persistent_count 0 109 109
Condition33%1/3
not defined $count and defined $persistent_count
!ll&&!rl&&r
01090
MC/DC0%0/2
not defined $count and defined $persistent_count
not defined $count defined $persistent_count
Truth table33%1/3
not(A) and B
A= not defined $countB= defined $persistent_count
ABresult
0X0
100
111
1249 if !defined($count) && defined($persistent_count);
1250  
1251 109 ▶return "$count $word"
Branch: 1 branch
BranchTrueFalseTotal
if defined $count and not $count =~ /^($PL_count_one)$/iou 0 109 109
Condition33%1/3
defined $count and not $count =~ /^($PL_count_one)$/iou
!ll&&!rl&&r
10900
MC/DC0%0/2
defined $count and not $count =~ /^($PL_count_one)$/iou
defined $count not $count =~ /^($PL_count_one)$/iou
Truth table33%1/3
A and not(B)
A= defined $countB= not $count =~ /^($PL_count_one)$/iou
ABresult
0X0
100
111
1252 if defined $count && $count!~/^($PL_count_one)$/io;
1253  
1254 # HANDLE USER-DEFINED VARIANTS
1255  
1256 109 my $value;
1257 109 ▶return $value if defined($value = ud_match($word, @A_a_user_defined));
Branch: 1 branch
BranchTrueFalseTotal
if defined($value = ud_match($word, @A_a_user_defined)) 0 109 109
1258  
1259 # HANDLE SPECIAL CASES
1260  
1261 109 ▶$word =~ /^($A_explicit_an)/i and return "an $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($A_explicit_an)/iu and return "an $word" 0 109 109
1262 109 ▶$word =~ /^[aefhilmnorsx]$/i and return "an $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^[aefhilmnorsx]$/iu and return "an $word" 0 109 109
1263 109 ▶$word =~ /^[bcdgjkpqtuvwyz]$/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^[bcdgjkpqtuvwyz]$/iu and return "a $word" 0 109 109
1264  
1265 # HANDLE ABBREVIATIONS
1266  
1267 109 ▶$word =~ /^($A_abbrev)/ox and return "an $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($A_abbrev)/oux and return "an $word" 0 109 109
1268 109 ▶$word =~ /^[aefhilmnorsx][.-]/i and return "an $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^[aefhilmnorsx][.-]/iu and return "an $word" 0 109 109
1269 109 ▶$word =~ /^[a-z][.-]/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^[a-z][.-]/iu and return "a $word" 11 98 109
1270  
1271 # HANDLE CONSONANTS
1272  
1273 98 ▶$word =~ /^[^aeiouy]/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^[^aeiouy]/iu and return "a $word" 53 45 98
1274  
1275 # HANDLE SPECIAL VOWEL-FORMS
1276  
1277 45 ▶$word =~ /^e[uw]/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^e[uw]/iu and return "a $word" 6 39 45
1278 39 ▶$word =~ /^onc?e\b/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^onc?e\b/iu and return "a $word" 2 37 39
1279 37 ▶$word =~ /^uni([^nmd]|mo)/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^uni([^nmd]|mo)/iu and return "a $word" 16 21 37
1280 21 ▶$word =~ /^u[bcfhjkqrst][aeiou]/i and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^u[bcfhjkqrst][aeiou]/iu and return "a $word" 14 7 21
1281  
1282 # HANDLE SPECIAL CAPITALS
1283  
1284 7 ▶$word =~ /^U[NK][AIEO]?/ and return "a $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^U[NK][AIEO]?/u and return "a $word" 2 5 7
1285  
1286 # HANDLE VOWELS
1287  
1288 5 ▶$word =~ /^[aeiou]/i and return "an $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^[aeiou]/iu and return "an $word" 0 5 5
1289  
1290 # HANDLE y... (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
1291  
1292 5 ▶$word =~ /^($A_y_cons)/io and return "an $word";
Branch: 1 branch
BranchTrueFalseTotal
$word =~ /^($A_y_cons)/iou and return "an $word" 0 5 5
1293  
1294 # OTHERWISE, GUESS "a"
1295 5 return "a $word";
1296 }
1297  
1298 # 2. TRANSLATE ZERO-QUANTIFIED $word TO "no PL($word)"
1299  
1300 sub NO
1301 {
1302 4 ▶my ($str, $count) = @_;
Subroutine NO: called CC=5 SCAR=16.5
Pod undocumented
1303 4 my ($pre, $word, $post) = ($str =~ m/\A(\s*)(.+?)(\s*)\Z/);
1304  
1305 4 ▶$count = $persistent_count
Branch: 1 branch
BranchTrueFalseTotal
if not defined $count and defined $persistent_count 0 4 4
Condition33%1/3
not defined $count and defined $persistent_count
!ll&&!rl&&r
400
MC/DC0%0/2
not defined $count and defined $persistent_count
not defined $count defined $persistent_count
Truth table33%1/3
not(A) and B
A= not defined $countB= defined $persistent_count
ABresult
0X0
100
111
1306 if !defined($count) && defined($persistent_count);
1307 4 ▶$count = 0 unless $count;
Branch: 1 branch
BranchTrueFalseTotal
unless $count 2 2 4
1308  
1309 4 ▶return "$pre$count " . PL($word,$count) . $post
Branch: 1 branch
BranchTrueFalseTotal
unless $count =~ /^$PL_count_zero$/u 2 2 4
1310 unless $count =~ /^$PL_count_zero$/;
1311 2 return "${pre}no ". PL($word,0) . $post ;
1312 }
1313  
1314 # PARTICIPLES
1315  
1316 sub PART_PRES
1317 {
1318 6 ▶ local $_ = PL_V(shift,2);
Subroutine PART_PRES: called CC=8 SCAR=22.8
Pod undocumented
1319 6 ▶ s/ie$/y/
Branch: 1 branch
BranchTrueFalseTotal
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u or s/ski$/ski/u or s/i$//u or s/([^e])e$/$1/u or /er$/u or s/([^aeiou][aeiouy]([bdgmnprst]))$/$1$2/u 4 2 6
Condition61%11/18
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u or s/ski$/ski/u or s/i$//u or s/([^e])e$/$1/u or /er$/u
l!l&&r!l&&!r
204
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u or s/ski$/ski/u or s/i$//u or s/([^e])e$/$1/u
l!l&&r!l&&!r
114
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u or s/ski$/ski/u or s/i$//u
l!l&&r!l&&!r
105
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u or s/ski$/ski/u
l!l&&r!l&&!r
015
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u
l!l&&r!l&&!r
006
s/ie$/y/u or s/ue$/u/u
l!l&&r!l&&!r
006
MC/DC28%2/7
s/ie$/y/u or s/ue$/u/u or s/([auy])e$/$1/u or s/ski$/ski/u or s/i$//u or s/([^e])e$/$1/u or /er$/u
s/ie$/y/u s/ue$/u/u s/([auy])e$/$1/u s/ski$/ski/u s/i$//u s/([^e])e$/$1/u /er$/u
Truth table37%3/8
A or B or C or D or E or F or G
A= s/ie$/y/uB= s/ue$/u/uC= s/([auy])e$/$1/uD= s/ski$/ski/uE= s/i$//uF= s/([^e])e$/$1/uG= /er$/u
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
00001XX1
000001X1
00000011
00000000
1320 or s/ue$/u/
1321 or s/([auy])e$/$1/
1322 or s/ski$/ski/
1323 or s/i$//
1324 or s/([^e])e$/$1/
1325 or m/er$/
1326 or s/([^aeiou][aeiouy]([bdgmnprst]))$/$1$2/;
1327 6 return "${_}ing";
1328 }
1329  
1330 # NUMERICAL INFLECTIONS
1331  
1332 14 my %nth =
1333 (
1334 0 => 'th',
1335 1 => 'st',
1336 2 => 'nd',
1337 3 => 'rd',
1338 4 => 'th',
1339 5 => 'th',
1340 6 => 'th',
1341 7 => 'th',
1342 8 => 'th',
1343 9 => 'th',
1344 11 => 'th',
1345 12 => 'th',
1346 13 => 'th',
1347 );
1348  
1349 14 my %ordinal;
1350 14 @ordinal{qw(ty one two three five eight nine twelve )}=
1351 qw(tieth first second third fifth eighth ninth twelfth);
1352  
1353 14 my $ordinal_suff = join '|', keys %ordinal, "";
1354  
1355 14 $ordinal{""} = 'th';
1356  
1357 sub ORD($)
1358 {
1359 164 ▶ my $num = shift;
Subroutine ORD: called CC=3 SCAR=11.0
Pod undocumented
1360 164 ▶ if ($num =~ /\d/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num =~ /\d/u) { } 82 82 164
1361 82 ▶ return $num . ($nth{$num%100} || $nth{$num%10});
Condition66%2/3
$nth{$num % 100} || $nth{$num % 10}
l!l&&r!l&&!r
45370
MC/DC0%0/2
$nth{$num % 100} || $nth{$num % 10}
$nth{$num % 100} $nth{$num % 10}
Truth table66%2/3
A || B
A= $nth{$num % 100}B= $nth{$num % 10}
ABresult
1X1
011
000
1362 }
1363 else {
1364 82 $num =~ s/($ordinal_suff)\Z/$ordinal{$1}/;
1365 82 return $num;
1366 }
1367 }
1368  
1369 14 my %default_args =
1370 (
1371 'group' => 0,
1372 'comma' => ',',
1373 'and' => 'and',
1374 'zero' => 'zero',
1375 'one' => 'one',
1376 'decimal' => 'point',
1377 );
1378  
1379 14 my @unit = ('',qw(one two three four five six seven eight nine));
1380 14 my @teen = qw(ten eleven twelve thirteen fourteen
1381 fifteen sixteen seventeen eighteen nineteen);
1382 14 my @ten = ('','',qw(twenty thirty forty fifty sixty seventy eighty ninety));
1383 14 my @mill = map { (my $val=$_) =~ s/_/illion/; " $val" }
1384 ('',qw(thousand m_ b_ tr_ quadr_ quint_ sext_ sept_ oct_ non_ dec_));
1385  
1386 1120 ▶sub mill { my $ind = $_[0]||0;
Subroutine mill: called CC=4 SCAR=14.3
Pod undocumented
Condition100%2/2
$_[0] || 0
l!l
801040
MC/DC100%1/1
$_[0] || 0
$_[0]
Truth table100%2/2
A
A= $_[0]
Aresult
11
00
1387 1120 ▶ die "Number out of range\n" if $ind > $#mill;
Branch: 1 branch
BranchTrueFalseTotal
if $ind > $#mill 0 1120 1120
1388 1120 ▶ return $ind<@mill ? $mill[$ind] : ' ???illion'; }
Branch: 1 branch
BranchTrueFalseTotal
$ind < @mill ? : 1120 0 1120
1389  
1390 755 ▶sub unit { return $unit[$_[0]]. mill($_[1]); }
Subroutine unit: called CC=1 SCAR=0.0
Pod undocumented
1391  
1392 sub ten
1393 {
1394 626 ▶ return $ten[$_[0]] . ($_[0]&&$_[1]?'-':'') . $unit[$_[1]] . mill($_[2])
Subroutine ten: called CC=5 SCAR=16.1
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
if $_[0] ne 1 249 377 626
$_[0] && $_[1] ? : 179 70 249
Condition100%3/3
$_[0] and $_[1]
!ll&&!rl&&r
2842179
MC/DC100%2/2
$_[0] and $_[1]
$_[0] $_[1]
Truth table100%3/3
A and B
A= $_[0]B= $_[1]
ABresult
0X0
100
111
1395 if $_[0] ne '1';
1396 377 ▶ return $teen[$_[1]]. $mill[$_[2]||0];
Condition100%2/2
$_[2] || 0
l!l
11366
MC/DC100%1/1
$_[2] || 0
$_[2]
Truth table100%2/2
A
A= $_[2]
Aresult
11
00
1397 }
1398  
1399 sub hund
1400 {
1401 128 ▶ return unit($_[0]) . " hundred" . ($_[1] || $_[2] ? " $_[4] " : '')
Subroutine hund: called CC=6 SCAR=17.9
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
if $_[0] 104 24 128
$_[1] || $_[2] ? : 89 15 104
Condition100%3/3
$_[1] or $_[2]
l!l&&r!l&&!r
82715
MC/DC100%2/2
$_[1] or $_[2]
$_[1] $_[2]
Truth table100%3/3
A or B
A= $_[1]B= $_[2]
ABresult
1X1
011
000
1402 . ten($_[1],$_[2]) . mill($_[3]) . ', ' if $_[0];
1403 24 ▶ return ten($_[1],$_[2]) . mill($_[3]) . ', ' if $_[1] || $_[2];
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] or $_[2] 12 12 24
Condition100%3/3
$_[1] or $_[2]
l!l&&r!l&&!r
6612
MC/DC100%2/2
$_[1] or $_[2]
$_[1] $_[2]
Truth table100%3/3
A or B
A= $_[1]B= $_[2]
ABresult
1X1
011
000
1404 12 return '';
1405 }
1406  
1407 sub enword
1408 {
1409 1039 ▶ my ($num,$group,$zero,$one,$comma,$and) = @_;
Subroutine enword: called CC=20 SCAR=30.0
Pod undocumented
1410  
1411 1039 ▶ if ($group==1)
Branch: 5 branches
BranchTrueFalseTotal
if ($group == 1) { } 85 954 1039
elsif ($group == 2) { } 63 891 954
elsif ($group == 3) { } 63 828 891
elsif ($num + 0 == 0) { } 48 780 828
elsif ($num + 0 == 1) { } 44 736 780
1412 {
1413 85 ▶ $num =~ s/(\d)/ ($1==1 ? " $one" : $1 ? unit($1) :" $zero")."$comma " /eg;
Branch: 2 branches
BranchTrueFalseTotal
$1 == 1 ? : 45 276 321
$1 ? : 231 45 276
1414 }
1415 elsif ($group==2)
1416 {
1417 63 ▶ $num =~ s/(\d)(\d)/ ($1 ? ten($1,$2) : $2 ? " $zero " . unit($2) : " $zero $zero") . "$comma " /eg;
Branch: 2 branches
BranchTrueFalseTotal
$1 ? : 92 10 102
$2 ? : 3 7 10
1418 63 ▶ $num =~ s/(\d)/ ($1 ? unit($1) :" $zero")."$comma " /e;
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 24 6 30
1419 }
1420 elsif ($group==3)
1421 {
1422 63 ▶ $num =~ s/(\d)(\d)(\d)/ ($1==1 ? " $one" : $1 ? unit($1) :" $zero")." ".($2 ? ten($2,$3) : $3 ? " $zero " . unit($3) : " $zero $zero") . "$comma " /eg;
Branch: 4 branches
BranchTrueFalseTotal
$1 == 1 ? : 20 35 55
$1 ? : 30 5 35
$2 ? : 40 15 55
$3 ? : 6 9 15
1423 63 ▶ $num =~ s/(\d)(\d)/ ($1 ? ten($1,$2) : $2 ? " $zero " . unit($2) : " $zero $zero") . "$comma " /e;
Branch: 2 branches
BranchTrueFalseTotal
$1 ? : 22 1 23
$2 ? : 0 1 1
1424 63 ▶ $num =~ s/(\d)/ ($1==1 ? " $one" : $1 ? unit($1) :" $zero")."$comma " /e;
Branch: 2 branches
BranchTrueFalseTotal
$1 == 1 ? : 2 21 23
$1 ? : 14 7 21
1425 }
1426 elsif ($num+0==0) {
1427 48 $num = $zero;
1428 }
1429 elsif ($num+0==1) {
1430 44 $num = $one;
1431 }
1432 else {
1433 736 $num =~ s/\A\s*0+//;
1434 736 my $mill = 0;
1435 736 ▶ 1 while $num =~ s/(\d)(\d)(\d)(?=\D*\Z)/ hund($1,$2,$3,$mill++,$and) /e;
Branch: 1 branch
BranchTrueFalseTotal
$num =~ s/(\d)(\d)(\d)(?=\D*\Z)/hund($1, $2, $3, $mill++, $and);/eu and do { '???' } 128 736 864
1436 736 $num =~ s/(\d)(\d)(?=\D*\Z)/ ten($1,$2,$mill)."$comma " /e;
1437 736 $num =~ s/(\d)(?=\D*\Z)/ unit($1,$mill) . "$comma "/e;
1438 }
1439 1039 return $num;
1440 }
1441  
1442 sub NUMWORDS
1443 {
1444 1281 ▶ my $num = shift;
Subroutine NUMWORDS: called CC=33 SCAR=35.3
Pod undocumented
1445  
1446 1281 ▶ if (@_ % 2 and require Carp) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ % 2 and require Carp) 55 1226 1281
Condition66%2/3
@_ % 2 and require Carp
!ll&&!rl&&r
1226055
MC/DC50%1/2
@_ % 2 and require Carp
@_ % 2 require Carp
Truth table66%2/3
A and B
A= @_ % 2B= require Carp
ABresult
0X0
100
111
1447 55 die "Missing value in option list (odd number of option args) at"
1448 . join ' line ', (caller)[1,2];
1449 }
1450  
1451 1226 my %arg = ( %default_args, @_ );
1452 1226 my $group = $arg{group};
1453  
1454 # Handle "stylistic" conversions (up to a given threshold)...
1455 1226 ▶ if (exists $arg{threshold} && $num > $arg{threshold}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $arg{"threshold"} and $num > $arg{"threshold"}) 230 996 1226
Condition100%3/3
exists $arg{"threshold"} and $num > $arg{"threshold"}
!ll&&!rl&&r
765231230
MC/DC100%2/2
exists $arg{"threshold"} and $num > $arg{"threshold"}
exists $arg{"threshold"} $num > $arg{"threshold"}
Truth table100%3/3
A and B
A= exists $arg{"threshold"}B= $num > $arg{"threshold"}
ABresult
0X0
100
111
1456 230 my ($whole, $frac) = split /[.]/, $num;
1457 230 ▶ while ($arg{comma}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg{"comma"}) 230 10 240
1458 230 ▶ $whole =~ s{ (\d) ( \d{3}(?:,|\z) ) }{$1,$2}xms
Branch: 1 branch
BranchTrueFalseTotal
$whole =~ s/ (\d) ( \d{3}(?:,|\z) ) /$1,$2/msux or last 220 10 230
1459 or last;
1460 }
1461 230 ▶ return $frac ? "$whole.$frac" : $whole;
Branch: 1 branch
BranchTrueFalseTotal
$frac ? : 10 220 230
1462 }
1463  
1464 996 ▶ die "Bad chunking option: $group\n" unless $group =~ /\A[0-3]\Z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $group =~ /\A[0-3]\Z/u 0 996 996
1465 996 ▶ my $sign = ($num =~ /\A\s*\+/) ? "plus"
Branch: 2 branches
BranchTrueFalseTotal
$num =~ /\A\s*\+/u ? : 0 996 996
$num =~ /\A\s*\-/u ? : 0 996 996
1466 : ($num =~ /\A\s*\-/) ? "minus"
1467 : '';
1468  
1469 996 my ($zero, $one) = @arg{'zero','one'};
1470 996 my $comma = $arg{comma};
1471 996 my $and = $arg{'and'};
1472  
1473 996 my $ord = $num =~ s/(st|nd|rd|th)\Z//;
1474 my @chunks = ($arg{decimal})
1475 996 ▶ ? $group ? split(/\./, $num) : split(/\./, $num, 2)
Branch: 2 branches
BranchTrueFalseTotal
$arg{'decimal'} ? : 996 0 996
$group ? : 165 831 996
1476 : ($num);
1477  
1478 996 my $first = 1;
1479  
1480 996 ▶ if ($chunks[0] eq '') { $first=0; shift @chunks; }
Branch: 1 branch
BranchTrueFalseTotal
if ($chunks[0] eq "") 6 990 996
1481  
1482 996 foreach ( @chunks )
1483 {
1484 1039 s/\D//g;
1485 1039 ▶ $_ = '0' unless $_;
Branch: 1 branch
BranchTrueFalseTotal
unless $_ 54 985 1039
1486  
1487 1039 ▶ if (!$group && !$first) { $_ = enword($_,1,$zero,$one,$comma,$and) }
Branch: 1 branch
BranchTrueFalseTotal
if (not $group || $first) { } 22 1017 1039
Condition100%3/3
$group || $first
l!l&&r!l&&!r
18982822
MC/DC100%2/2
$group || $first
$group $first
Truth table100%3/3
A || B
A= $groupB= $first
ABresult
1X1
011
000
1488 1017 else { $_ = enword($_,$group,$zero,$one,$comma,$and) }
1489  
1490 1039 s/, \Z//;
1491 1039 s/\s+,/,/g;
1492 1039 ▶ s/, (\S+)\s+\Z/ $and $1/ if !$group and $first;
Branch: 1 branch
BranchTrueFalseTotal
if not $group and $first 828 211 1039
Condition100%3/3
not $group and $first
!ll&&!rl&&r
18922828
MC/DC100%2/2
not $group and $first
not $group $first
Truth table100%3/3
not(A) and B
A= not $groupB= $first
ABresult
0X0
100
111
1493 1039 s/\s+/ /g;
1494 1039 s/(\A\s|\s\Z)//g;
1495 1039 ▶ $first = '' if $first;
Branch: 1 branch
BranchTrueFalseTotal
if $first 990 49 1039
1496 }
1497  
1498 996 my @numchunks = ();
1499 996 ▶ if ($first =~ /0/)
Branch: 1 branch
BranchTrueFalseTotal
if ($first =~ /0/u) { } 6 990 996
1500 {
1501 6 unshift @chunks, '';
1502 }
1503 else
1504 {
1505 990 @numchunks = split /\Q$comma /, $chunks[0];
1506 }
1507  
1508 996 ▶ $numchunks[-1] =~ s/($ordinal_suff)\Z/$ordinal{$1}/
Branch: 1 branch
BranchTrueFalseTotal
if $ord and @numchunks 51 945 996
Condition100%3/3
$ord and @numchunks
!ll&&!rl&&r
944151
MC/DC100%2/2
$ord and @numchunks
$ord @numchunks
Truth table100%3/3
A and B
A= $ordB= @numchunks
ABresult
0X0
100
111
1509 if $ord and @numchunks;
1510  
1511 996 foreach (@chunks[1..$#chunks])
1512 {
1513 49 push @numchunks, $arg{decimal};
1514 49 push @numchunks, split /\Q$comma /;
1515 }
1516  
1517 996 ▶ if (wantarray)
Branch: 2 branches
BranchTrueFalseTotal
if (wantarray) { } 0 996 996
elsif ($group) { } 165 831 996
1518 {
1519 0 ▶ unshift @numchunks, $sign if $sign;
Branch: 1 branch
BranchTrueFalseTotal
if $sign 0 0 0
1520 return @numchunks
1521 0 }
1522 elsif ($group)
1523 {
1524 165 ▶ return ($sign?"$sign ":'') . join ", ", @numchunks;
Branch: 1 branch
BranchTrueFalseTotal
$sign ? : 0 165 165
1525 }
1526 else
1527 {
1528 831 ▶ $num = ($sign?"$sign ":'') . shift @numchunks;
Branch: 1 branch
BranchTrueFalseTotal
$sign ? : 0 831 831
1529 831 $first = ($num !~ /$arg{decimal}\Z/);
1530 831 foreach ( @numchunks )
1531 {
1532 176 ▶ if (/\A$arg{decimal}\Z/)
Branch: 2 branches
BranchTrueFalseTotal
if (/\A$arg{'decimal'}\Z/u) { } 19 157 176
elsif ($first) { } 70 87 157
1533 {
1534 19 $num .= " $_";
1535 19 $first = 0;
1536 }
1537 elsif ($first)
1538 {
1539 70 $num .= "$comma $_";
1540 }
1541 else
1542 {
1543 87 $num .= " $_";
1544 }
1545 }
1546 831 return $num;
1547 }
1548 }
1549  
1550 # Join words with commas and a trailing 'and' (when appropriate)...
1551  
1552 sub WORDLIST {
1553 20 ▶ my %opt;
Subroutine WORDLIST: called CC=11 SCAR=24.0
Pod undocumented
1554 my @words;
1555  
1556 20 for my $arg (@_) {
1557 61 ▶ if (ref $arg eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $arg eq 'HASH') { } 16 45 61
1558 16 %opt = (%opt, %{$arg});
1559 }
1560 else {
1561 45 push @words, $arg;
1562 }
1563 }
1564  
1565 20 ▶ return "" if @words == 0;
Branch: 1 branch
BranchTrueFalseTotal
if @words == 0 0 20 20
1566 20 ▶ return "$words[0]" if @words == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @words == 1 5 15 20
1567  
1568 15 ▶ my $conj = exists($opt{conj}) ? $opt{conj} : 'and';
Branch: 1 branch
BranchTrueFalseTotal
exists $opt{'conj'} ? : 6 9 15
1569 15 ▶ if (@words == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@words == 2) 5 10 15
1570 5 $conj =~ s/^ (?=[^\W\d_]) | (?<=[^\W\d_]) $/ /gxms;
1571 5 return "$words[0]$conj$words[1]";
1572 }
1573  
1574 my $sep = exists $opt{sep} ? $opt{sep}
1575 10 ▶ : grep(/,/, @words) ? q{; }
Branch: 2 branches
BranchTrueFalseTotal
exists $opt{'sep'} ? : 0 10 10
grep(/,/u, @words) ? : 5 5 10
1576 : q{, }
1577 ;
1578  
1579 my $final_sep = !exists $opt{final_sep} ? "$sep $conj"
1580 10 ▶ : length($opt{final_sep}) == 0 ? $conj
Branch: 2 branches
BranchTrueFalseTotal
!exists $opt{'final_sep'} ? : 4 6 10
length $opt{'final_sep'} == 0 ? : 2 4 6
1581 : "$opt{final_sep} $conj"
1582 ;
1583 10 $final_sep =~ s/\s+/ /gmxs;
1584 10 $final_sep =~ s/^ (?=[^\W\d_]) | (?<=[^\W\d_]) $/ /gxms;
1585  
1586 10 return join($sep, @words[0,@words-2]) . "$final_sep$words[-1]";
1587 }
1588  
1589 14 1;
1590  
1591 __END__
↑ Summary