blib/lib/Lingua/ENG/Inflect.pm

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