Inflexion/Term.pm

filter: Statementstmt 77.2% 194 / 251 Branchbran 85.5% 65 / 76 Conditioncond 60.7% 119 / 196 MC/DCmcdc 17.0% 16 / 94 Subroutinesub 61.1% 44 / 72 Podpod 0.0% 0 / 7 totaltotal 62.9% 438 / 696 CC 104 SCAR 21.8
CC
104
Cov
72%
ordinal
30.0
plural
25.8
__ANON__
23.8
CRAP 8.8
« Inflexion/Indefinite.pm ↑ Summary Inflexion/Verbs.pm »
1 package Lingua::EN::Inflexion::Term;
2  
3 32 ▶use 5.010; use warnings; use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 32 ▶no if $] >= 5.018, warnings => "experimental::smartmatch";
Subroutine BEGIN: called CC=1 SCAR=0.0
5 32 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 32 ▶use Hash::Util 'fieldhash';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 32 fieldhash my %term_of;
10  
11 # Inside-out constructor...
12 sub new {
13 26198 ▶ my ($class, $term) = @_;
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
14  
15 26198 my $object = bless do{ \my $scalar }, $class;
16  
17 26198 ▶ $term_of{$object} = $term // croak "Missing arg to $class ctor";
Condition33%1/3
$term // croak("Missing arg to $class ctor")
l!l&&r!l&&!r
2619800
MC/DC0%0/2
$term // croak("Missing arg to $class ctor")
$term croak("Missing arg to $class ctor")
Truth table33%1/3
A // B
A= $termB= croak("Missing arg to $class ctor")
ABresult
1X1
011
000
18  
19 26198 return $object;
20 }
21  
22 # Replicate casing...
23 my $encase = sub {
24 31981 ▶ my ($original, $target) = @_;
Subroutine __ANON__: called CC=8 SCAR=20.8
25  
26 # Special case for 'I'
27 31981 ▶ return $target if $original eq 'I' || $target eq 'I';
Branch: 1 branch
BranchTrueFalseTotal
if $original eq "I" or $target eq "I" 22 31959 31981
Condition100%3/3
$original eq "I" or $target eq "I"
l!l&&r!l&&!r
13931959
MC/DC100%2/2
$original eq "I" or $target eq "I"
$original eq "I" $target eq "I"
Truth table100%3/3
A or B
A= $original eq "I"B= $target eq "I"
ABresult
1X1
011
000
28  
29 # Construct word-by-word case transformations...
30 my @transforms
31 31959 ▶ = map { /\A[[:lower:][:^alpha:]]+\Z/ ? sub { lc shift }
Subroutine __ANON__: called CC=1 SCAR=0.0
32 1550 ▶ : /\A[[:upper:]][[:lower:][:^alpha:]]+\Z/ ? sub { ucfirst lc shift }
Subroutine __ANON__: called CC=1 SCAR=0.0
33 461 ▶ : /\A[[:upper:][:^alpha:]]+\Z/ ? sub { uc shift }
Subroutine __ANON__: called CC=1 SCAR=0.0
34 78 ▶ : sub { shift }
Subroutine __ANON__: called CC=1 SCAR=0.0
35 34042 ▶ }
Branch: 3 branches
BranchTrueFalseTotal
/\A[[:lower:][:^alpha:]]+\Z/ ? : 31953 2089 34042
/\A[[:upper:]][[:lower:][:^alpha:]]+\Z/ ? : 1550 539 2089
/\A[[:upper:][:^alpha:]]+\Z/ ? : 461 78 539
36 split /\s+/, $original;
37  
38 31959 ▶ if (!@transforms) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@transforms) 2 31957 31959
39 2 ▶ @transforms = sub {shift};
Subroutine __ANON__: called CC=1 SCAR=0.0
40 }
41  
42 # Apply to target...
43 31959 $target =~ s{(\S+)}
44 34033 ▶ { my $transform = @transforms > 1 ? shift @transforms : $transforms[0];
Branch: 1 branch
BranchTrueFalseTotal
@transforms > 1 ? : 2085 31948 34033
45 34033 $transform->($1);
46 }xmseg;
47  
48 31959 return $target;
49 32 };
50  
51 # Report part-of-speech...
52 0 ▶sub is_noun { 0 }
Subroutine is_noun: not called CC=1 SCAR=6.9
Pod undocumented
53 0 ▶sub is_verb { 0 }
Subroutine is_verb: not called CC=1 SCAR=6.9
Pod undocumented
54 0 ▶sub is_adj { 0 }
Subroutine is_adj: not called CC=1 SCAR=6.9
Pod undocumented
55  
56 # Default classical/unassimilated mode does nothing...
57 0 ▶sub classical { return shift; }
Subroutine classical: not called CC=1 SCAR=6.9
Pod undocumented
58 0 ▶sub unassimilated { return shift->classical; }
Subroutine unassimilated: not called CC=1 SCAR=6.9
Pod undocumented
59  
60 # Coerce to original...
61 32 ▶use Scalar::Util qw< refaddr blessed >;
Subroutine BEGIN: called CC=1 SCAR=0.0
62 use overload (
63 0 ▶ q[qr] => sub { return shift->as_regex(); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
64 1007 ▶ q[""] => sub { return "$term_of{shift()}"; },
Subroutine __ANON__: called CC=1 SCAR=0.0
65 0 ▶ q[0+] => sub { return refaddr(shift); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
66 2 ▶ q[bool] => sub { return 1; },
Subroutine __ANON__: called CC=1 SCAR=0.0
67 0 ▶ q[${}] => sub { croak "Can't coerce ", ref(shift), ' object to scalar reference'; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
68 0 ▶ q[@{}] => sub { croak "Can't coerce ", ref(shift), ' object to array reference'; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
69 0 ▶ q[%{}] => sub { croak "Can't coerce ", ref(shift), ' object to hash reference'; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
70 0 ▶ q[&{}] => sub { croak "Can't coerce ", ref(shift), ' object to subroutine reference'; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
71 0 ▶ q[*{}] => sub { croak "Can't coerce ", ref(shift), ' object to typeglob reference'; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
72  
73 q[~~] => sub {
74 141 ▶ my ($term, $other_arg) = @_;
Subroutine __ANON__: called CC=5 SCAR=16.5
75  
76 # Handle TERM ~~ TERM...
77 141 ▶ if (blessed($other_arg) && $other_arg->isa(__PACKAGE__)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($other_arg) and $other_arg->isa(__PACKAGE__)) { } 47 94 141
Condition66%2/3
builtin::blessed($other_arg) and $other_arg->isa(__PACKAGE__)
!ll&&!rl&&r
94047
MC/DC50%1/2
builtin::blessed($other_arg) and $other_arg->isa(__PACKAGE__)
builtin::blessed($other_arg) $other_arg->isa(__PACKAGE__)
Truth table66%2/3
A and B
A= builtin::blessed($other_arg)B= $other_arg->isa(__PACKAGE__)
ABresult
0X0
100
111
78 47 ▶ return lc($term->singular) eq lc($other_arg->singular)
Condition66%4/6
lc $term->singular eq lc $other_arg->singular || lc $term->plural eq lc $other_arg->plural || lc $term->classical->plural eq lc $other_arg->classical->plural
l!l&&r!l&&!r
4502
lc $term->singular eq lc $other_arg->singular or lc $term->plural eq lc $other_arg->plural
l!l&&r!l&&!r
4502
MC/DC33%1/3
lc $term->singular eq lc $other_arg->singular || lc $term->plural eq lc $other_arg->plural || lc $term->classical->plural eq lc $other_arg->classical->plural
lc $term->singular eq lc $other_arg->singular lc $term->plural eq lc $other_arg->plural lc $term->classical->plural eq lc $other_arg->classical->plural
Truth table50%2/4
A or B || C
A= lc $term->singular eq lc $other_arg->singularB= lc $term->plural eq lc $other_arg->pluralC= lc $term->classical->plural eq lc $other_arg->classical->plural
ABCresult
1XX1
01X1
0011
0000
79 || lc($term->plural) eq lc($other_arg->plural)
80 || lc($term->classical->plural) eq lc($other_arg->classical->plural);
81 }
82  
83 # Otherwise just smartmatch against TERM as regex....
84 else {
85 94 return $other_arg ~~ $term->as_regex;
86 }
87 },
88  
89  
90 32 fallback => 1,
91 32 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
92  
93 # Treat as regex...
94 sub as_regex {
95 94 ▶ my ($self) = @_;
Subroutine as_regex: called CC=1 SCAR=0.0
Pod undocumented
96 94 my %seen;
97 94 my $pattern = join '|', map { quotemeta } reverse sort grep { !$seen{$_}++ }
98 ($self->singular, $self->plural, $self->classical->plural);
99 94 return qr{$pattern}i;
100 }
101  
102  
103 package Lingua::EN::Inflexion::Noun;
104 32 our @ISA = 'Lingua::EN::Inflexion::Term';
105  
106 32 ▶use Lingua::EN::Inflexion::Nouns;
Subroutine BEGIN: called CC=1 SCAR=0.0
107 32 ▶use Lingua::EN::Inflexion::Indefinite;
Subroutine BEGIN: called CC=1 SCAR=0.0
108  
109 # Report number of the noun...
110 sub is_plural {
111 3041 ▶ my ($self) = @_;
Subroutine is_plural: called CC=1 SCAR=0.0
112 3041 return Lingua::EN::Inflexion::Nouns::is_plural( $term_of{$self} );
113 }
114  
115 sub is_singular {
116 2473 ▶ my ($self) = @_;
Subroutine is_singular: called CC=1 SCAR=0.0
117 2473 return Lingua::EN::Inflexion::Nouns::is_singular( $term_of{$self} );
118 }
119  
120 # Report part-of-speech...
121 0 ▶sub is_noun { 1 }
Subroutine is_noun: not called CC=1 SCAR=6.9
122  
123 # Return plural and singular forms of the noun...
124  
125 32 my %noun_inflexion_of = (
126 # CASE TERM 0TH 1ST 2ND 3RD
127 nominative => {
128 i => { number => 'singular', person => 1,
129 singular => [qw< I I you it >],
130 plural => [qw< we we you they >],
131 },
132 you => { number => 'singular', person => 2,
133 singular => [qw< you I you it >],
134 plural => [qw< you we you they >],
135 },
136 she => { number => 'singular', person => 3,
137 singular => [qw< she I you she >],
138 plural => [qw< they we you they >],
139 },
140 he => { number => 'singular', person => 3,
141 singular => [qw< he I you he >],
142 plural => [qw< they we you they >],
143 },
144 it => { number => 'singular', person => 3,
145 singular => [qw< it I you it >],
146 plural => [qw< they we you they >],
147 },
148 we => { number => 'plural', person => 1,
149 singular => [qw< I I you it >],
150 plural => [qw< we we you they >],
151 },
152 they => { number => 'plural', person => 3,
153 singular => [qw< it I you it >],
154 plural => [qw< they we you they >],
155 },
156 one => { number => 'singular', person => 3,
157 singular => [qw< one I you one >],
158 plural => [qw< some we you some >],
159 },
160 this => { number => 'singular', person => 3,
161 singular => [qw< this this this this >],
162 plural => [qw< these these these these >],
163 },
164 that => { number => 'singular', person => 3,
165 singular => [qw< that that that that >],
166 plural => [qw< those those those those >],
167 },
168 these => { number => 'plural', person => 3,
169 singular => [qw< this this this this >],
170 plural => [qw< these these these these >],
171 },
172 those => { number => 'plural', person => 3,
173 singular => [qw< that that that that >],
174 plural => [qw< those those those those >],
175 },
176 who => { number => 'singular', person => 3,
177 singular => [qw< who who who who >],
178 plural => [qw< who who who who >],
179 },
180 whoever => { number => 'singular', person => 3,
181 singular => [qw< whoever whoever whoever whoever >],
182 plural => [qw< whoever whoever whoever whoever >],
183 },
184 whosoever => { number => 'singular', person => 3,
185 singular => [qw< whosoever whosoever whosoever whosoever >],
186 plural => [qw< whosoever whosoever whosoever whosoever >],
187 },
188 },
189 objective => {
190 me => { number => 'singular', person => 1,
191 singular => [qw< me me you it >],
192 plural => [qw< us us you them >],
193 },
194 you => { number => 'singular', person => 2,
195 singular => [qw< you me you it >],
196 plural => [qw< you us you them >],
197 },
198 her => { number => 'singular', person => 3,
199 singular => [qw< her me you her >],
200 plural => [qw< them us you them >],
201 },
202 him => { number => 'singular', person => 3,
203 singular => [qw< him me you him >],
204 plural => [qw< them us you them >],
205 },
206 it => { number => 'singular', person => 3,
207 singular => [qw< it me you it >],
208 plural => [qw< them us you them >],
209 },
210 one => { number => 'singular', person => 3,
211 singular => [qw< one me you one >],
212 plural => [qw< some us you some >],
213 },
214 us => { number => 'plural', person => 1,
215 singular => [qw< me me you it >],
216 plural => [qw< us us you them >],
217 },
218 them => { number => 'plural', person => 3,
219 singular => [qw< it me you it >],
220 plural => [qw< them us you them >],
221 },
222 this => { number => 'singular', person => 3,
223 singular => [qw< this this this this >],
224 plural => [qw< these these these these >],
225 },
226 that => { number => 'singular', person => 3,
227 singular => [qw< that that that that >],
228 plural => [qw< those those those those >],
229 },
230 these => { number => 'plural', person => 3,
231 singular => [qw< this this this this >],
232 plural => [qw< these these these these >],
233 },
234 those => { number => 'plural', person => 3,
235 singular => [qw< that that that that >],
236 plural => [qw< those those those those >],
237 },
238 whom => { number => 'singular', person => 3,
239 singular => [qw< whom whom whom whom >],
240 plural => [qw< whom whom whom whom >],
241 },
242 whomever => { number => 'singular', person => 3,
243 singular => [qw< whomever whomever whomever whomever >],
244 plural => [qw< whomever whomever whomever whomever >],
245 },
246 whomsoever => { number => 'singular', person => 3,
247 singular => [qw< whomsoever whomsoever whomsoever whomsoever >],
248 plural => [qw< whomsoever whomsoever whomsoever whomsoever >],
249 },
250 },
251 possessive => {
252 mine => { number => 'singular', person => 1,
253 singular => [qw< mine mine yours its >],
254 plural => [qw< ours ours yours theirs >],
255 },
256 yours => { number => 'singular', person => 2,
257 singular => [qw< yours mine yours its >],
258 plural => [qw< yours ours yours theirs >],
259 },
260 hers => { number => 'singular', person => 3,
261 singular => [qw< hers mine yours hers >],
262 plural => [qw< theirs ours yours theirs >],
263 },
264 his => { number => 'singular', person => 3,
265 singular => [qw< his mine yours his >],
266 plural => [qw< theirs ours yours theirs >],
267 },
268 its => { number => 'singular', person => 3,
269 singular => [qw< its mine yours its >],
270 plural => [qw< theirs ours yours theirs >],
271 },
272 "one's" => { number => 'singular', person => 3,
273 singular => [qw< one's mine yours one's >],
274 plural => [qw< theirs ours yours theirs >],
275 },
276 ours => { number => 'plural', person => 1,
277 singular => [qw< mine mine yours its >],
278 plural => [qw< ours ours yours theirs >],
279 },
280 theirs => { number => 'plural', person => 3,
281 singular => [qw< its mine yours its >],
282 plural => [qw< theirs ours yours theirs >],
283 },
284 whose => { number => 'singular', person => 3,
285 singular => [qw< whose whose whose whose >],
286 plural => [qw< whose whose whose whose >],
287 },
288 whosever => { number => 'singular', person => 3,
289 singular => [qw< whosever whosever whosever whosever >],
290 plural => [qw< whosever whosever whosever whosever >],
291 },
292 whosesoever=> { number => 'singular', person => 3,
293 singular => [qw< whosesoever whosesoever whosesoever whosesoever >],
294 plural => [qw< whosesoever whosesoever whosesoever whosesoever >],
295 },
296 },
297 reflexive => {
298 myself => { number => 'singular', person => 1,
299 singular => [qw< myself myself yourself itself >],
300 plural => [qw< ourselves ourselves yourselves themselves >],
301 },
302 yourself => { number => 'singular', person => 2,
303 singular => [qw< yourself myself yourself itself >],
304 plural => [qw< yourselves ourselves yourselves themselves >],
305 },
306 herself => { number => 'singular', person => 3,
307 singular => [qw< herself myself yourself herself >],
308 plural => [qw< themselves ourselves yourselves themselves >],
309 },
310 himself => { number => 'singular', person => 3,
311 singular => [qw< himself myself yourself himself >],
312 plural => [qw< themselves ourselves yourselves themselves >],
313 },
314 themself => { number => 'singular', person => 3,
315 singular => [qw< themselves myself yourself themselves >],
316 plural => [qw< themselves ourselves yourselves themselves >],
317 },
318 itself => { number => 'singular', person => 3,
319 singular => [qw< itself myself yourself itself >],
320 plural => [qw< themselves ourselves yourselves themselves >],
321 },
322 oneself => { number => 'singular', person => 3,
323 singular => [qw< oneself myself yourself oneself >],
324 plural => [qw< oneselves ourselves yourselves oneselves >],
325 },
326 ourselves => { number => 'plural', person => 1,
327 singular => [qw< myself myself yourself itself >],
328 plural => [qw< ourselves ourselves yourselves themselves >],
329 },
330 yourselves => { number => 'plural', person => 2,
331 singular => [qw< yourself myself yourself itself >],
332 plural => [qw< yourselves ourselves yourselves themselves >],
333 },
334 themselves => { number => 'plural', person => 3,
335 singular => [qw< themselves myself yourself themselves >],
336 plural => [qw< themselves ourselves yourselves themselves >],
337 },
338 oneselves => { number => 'plural', person => 3,
339 singular => [qw< oneself myself yourself oneself >],
340 plural => [qw< oneselves ourselves yourselves oneselves >],
341 },
342 },
343 );
344  
345 32 my $PREP_PAT = qr{ about | above | across | after | among | around | athwart
346 | at | before | behind | below | beneath | besides?
347 | between | betwixt | beyond | but | by | during
348 | except | for | from | into | in | near | off
349 | of | onto | on | out | over | since | till
350 | to | under | until | unto | upon | within | without | with
351 }xmsi;
352  
353 sub singular {
354 12187 ▶ my $self = shift;
Subroutine singular: called CC=12 SCAR=25.0
355 12187 ▶ my $person = shift // 0;
Condition100%2/2
shift() // 0
l!l
10812079
MC/DC100%1/1
shift() // 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
356  
357 12187 my $term = $term_of{$self};
358  
359 # Prepositions imply objective or possessive...
360 12187 ▶ my $preposition = $term =~ s{ \A ( \s* $PREP_PAT \s+ ) }{}xi ? $1 : q{};
Branch: 1 branch
BranchTrueFalseTotal
$term =~ s/ \A ( \s* $PREP_PAT \s+ ) //xi ? : 44 12143 12187
361  
362 return
363 $preposition ? $preposition
364 . $encase->( $term,
365 $noun_inflexion_of{objective }{lc $term}{singular}[$person]
366 // $noun_inflexion_of{possessive}{lc $term}{singular}[$person]
367 // $noun_inflexion_of{reflexive }{lc $term}{singular}[$person]
368 // $noun_inflexion_of{nominative}{lc $term}{singular}[$person]
369 // Lingua::EN::Inflexion::Nouns::convert_to_singular( $term, $person )
370 )
371 : $encase->( $term,
372 $noun_inflexion_of{nominative}{lc $term}{singular}[$person]
373 // $noun_inflexion_of{objective }{lc $term}{singular}[$person]
374 // $noun_inflexion_of{possessive}{lc $term}{singular}[$person]
375 12187 ▶ // $noun_inflexion_of{reflexive }{lc $term}{singular}[$person]
Branch: 1 branch
BranchTrueFalseTotal
$preposition ? : 44 12143 12187
Condition83%20/24
((($noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
l!l&&r!l&&!r
3860
(($noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person]
l!l&&r!l&&!r
3806
($noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]
l!l&&r!l&&!r
3806
$noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]
l!l&&r!l&&!r
18206
((($noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
l!l&&r!l&&!r
186119570
(($noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]
l!l&&r!l&&!r
1285811957
($noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]
l!l&&r!l&&!r
903812015
$noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]
l!l&&r!l&&!r
573312053
MC/DC0%0/5
((($noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
$noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person] $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person] $noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
MC/DC0%0/5
((($noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
$noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person] $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person] $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person] $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person] Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
Truth table50%3/6
A // B // C // D // E
A= $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]B= $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]C= $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]D= $noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person]E= Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
Truth table83%5/6
A // B // C // D // E
A= $noun_inflexion_of{"nominative"}{lc $term}{"singular"}[$person]B= $noun_inflexion_of{"objective"}{lc $term}{"singular"}[$person]C= $noun_inflexion_of{"possessive"}{lc $term}{"singular"}[$person]D= $noun_inflexion_of{"reflexive"}{lc $term}{"singular"}[$person]E= Lingua::EN::Inflexion::Nouns::convert_to_singular($term, $person)
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
376 // Lingua::EN::Inflexion::Nouns::convert_to_singular( $term, $person )
377 );
378 }
379  
380  
381 sub plural {
382 6493 ▶ my $self = shift;
Subroutine plural: called CC=12 SCAR=25.0
383 6493 ▶ my $person = shift // 0;
Condition100%2/2
shift() // 0
l!l
1986295
MC/DC100%1/1
shift() // 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
384  
385 6493 my $term = $term_of{$self};
386  
387 # Prepositions imply objective or possessive (or dative)...
388 6493 ▶ my $preposition = $term =~ s{ \A ( \s* $PREP_PAT \s+ ) }{}xi ? $1 : q{};
Branch: 1 branch
BranchTrueFalseTotal
$term =~ s/ \A ( \s* $PREP_PAT \s+ ) //xi ? : 96 6397 6493
389  
390 return
391 $preposition ? $preposition
392 . $encase->( $term,
393 $noun_inflexion_of{objective }{lc $term}{plural}[$person]
394 // $noun_inflexion_of{possessive}{lc $term}{plural}[$person]
395 // $noun_inflexion_of{reflexive }{lc $term}{plural}[$person]
396 // $noun_inflexion_of{nominative}{lc $term}{plural}[$person]
397 // Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term,$person)
398 )
399 : $encase->( $term,
400 $noun_inflexion_of{nominative}{lc $term}{plural}[$person]
401 // $noun_inflexion_of{objective }{lc $term}{plural}[$person]
402 // $noun_inflexion_of{possessive}{lc $term}{plural}[$person]
403 6493 ▶ // $noun_inflexion_of{reflexive }{lc $term}{plural}[$person]
Branch: 1 branch
BranchTrueFalseTotal
$preposition ? : 96 6397 6493
Condition83%20/24
((($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
l!l&&r!l&&!r
9060
(($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
9006
($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
9006
$noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
58326
((($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
l!l&&r!l&&!r
23061670
(($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
177536167
($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
121566220
$noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
78436276
MC/DC0%0/5
((($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
$noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
MC/DC0%0/5
((($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
$noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person] Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
Truth table50%3/6
A // B // C // D // E
A= $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]B= $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]C= $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]D= $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]E= Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
Truth table83%5/6
A // B // C // D // E
A= $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]B= $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]C= $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]D= $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]E= Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term, $person)
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
404 // Lingua::EN::Inflexion::Nouns::convert_to_modern_plural($term,$person)
405 );
406 }
407  
408  
409 sub indef_article {
410 0 ▶ my ($self) = @_;
Subroutine indef_article: not called CC=1 SCAR=6.9
411  
412 0 return Lingua::EN::Inflexion::Indefinite::select_indefinite_article($self->singular);
413 }
414  
415 sub indefinite {
416 958 ▶ my ($self, $count) = @_;
Subroutine indefinite: called CC=3 SCAR=11.0
417 958 ▶ $count //= 1;
Condition100%2/2
$count //= 1
l!l
717241
MC/DC100%1/1
$count //= 1
$count
Truth table100%2/2
A
A= $count
Aresult
11
00
418  
419 958 ▶ if ($count == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count == 1) { } 480 478 958
420 480 return Lingua::EN::Inflexion::Indefinite::prepend_indefinite_article($self->singular);
421 }
422 else {
423 478 return "$count " . $self->plural;
424 }
425 }
426  
427  
428 # Conversions to ordinal and cardinal numbers (with module loaded on demand)...
429 my $num2word = sub {
430 2 ▶ state $load = require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower');
Subroutine __ANON__: called CC=2 SCAR=14.0
Condition0%0/3
require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower')
!ll&&!rl&&r
000
MC/DC0%0/2
require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower')
require Lingua::EN::Nums2Words Lingua::EN::Nums2Words::set_case('lower')
Truth table0%0/3
A && B
A= require Lingua::EN::Nums2WordsB= Lingua::EN::Nums2Words::set_case('lower')
ABresult
0X0
100
111
431 0 Lingua::EN::Nums2Words::num2word(@_);
432 32 };
433  
434 my $num2word_short_ordinal = sub {
435 0 ▶ state $load = require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower');
Subroutine __ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower')
!ll&&!rl&&r
000
MC/DC0%0/2
require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower')
require Lingua::EN::Nums2Words Lingua::EN::Nums2Words::set_case('lower')
Truth table0%0/3
A && B
A= require Lingua::EN::Nums2WordsB= Lingua::EN::Nums2Words::set_case('lower')
ABresult
0X0
100
111
436 0 Lingua::EN::Nums2Words::num2word_short_ordinal(@_);
437 32 };
438  
439 my $num2word_ordinal = sub {
440 0 ▶ state $load = require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower');
Subroutine __ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower')
!ll&&!rl&&r
000
MC/DC0%0/2
require Lingua::EN::Nums2Words && Lingua::EN::Nums2Words::set_case('lower')
require Lingua::EN::Nums2Words Lingua::EN::Nums2Words::set_case('lower')
Truth table0%0/3
A && B
A= require Lingua::EN::Nums2WordsB= Lingua::EN::Nums2Words::set_case('lower')
ABresult
0X0
100
111
441 0 Lingua::EN::Nums2Words::num2word_ordinal(@_);
442 32 };
443  
444 # These words may need an "and" before them...
445 32 my $LAST_WORD = qr{
446 one | two | three | four | five | six | seven | eight | nine | ten
447 | eleven | twelve | teen | ty
448 | first | second | third | [rfxnhe]th
449 }x;
450  
451 # These words may need an "and" after them...
452 32 my $POWER_WORD = qr{
453 hundred | thousand | \S+illion
454 }x;
455  
456 sub cardinal {
457 3 ▶ my $value = $term_of{ shift() };
Subroutine cardinal: called CC=5 SCAR=19.0
458 3 my $max_trans = shift();
459  
460 # Load the necessary module, and compensate for its persnicketiness...
461 3 state $load = require Lingua::EN::Words2Nums;
462 3 ▶ local $SIG{__WARN__} = sub{};
Subroutine __ANON__: not called CC=1 SCAR=0.0
463  
464 # Make sure we have a number...
465 3 ▶ $value = Lingua::EN::Words2Nums::words2nums($value) // $value;
Condition33%1/3
Lingua::EN::Words2Nums::words2nums($value) // $value
l!l&&r!l&&!r
300
MC/DC0%0/2
Lingua::EN::Words2Nums::words2nums($value) // $value
Lingua::EN::Words2Nums::words2nums($value) $value
Truth table33%1/3
A // B
A= Lingua::EN::Words2Nums::words2nums($value)B= $value
ABresult
1X1
011
000
466  
467 # If it's above threshold, return it as a number...
468 3 ▶ return $value
Branch: 1 branch
BranchTrueFalseTotal
if defined $max_trans and $value >= $max_trans 1 2 3
Condition100%3/3
defined $max_trans and $value >= $max_trans
!ll&&!rl&&r
111
MC/DC100%2/2
defined $max_trans and $value >= $max_trans
defined $max_trans $value >= $max_trans
Truth table100%3/3
A and B
A= defined $max_transB= $value >= $max_trans
ABresult
0X0
100
111
469 if defined $max_trans && $value >= $max_trans;
470  
471 # Otherwise, convert it to words...
472 2 my $words = $num2word->($value);
473  
474 # Correct for proper English pronunciation...
475 0 ▶ if ($value > 100) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value > 100) 0 0 0
476 0 $words =~ s{ ($POWER_WORD) \s+ (\S*$LAST_WORD) \b } {$1 and $2}gx;
477 0 $words =~ s{ (?<! and ) \s+ (\S*$LAST_WORD) $ } { and $1}gx;
478 0 $words =~ s{ ^ ([^,]+),([^,]+) $ } {$1$2}x;
479 }
480  
481 0 return $words;
482 }
483  
484 sub ordinal {
485 0 ▶ my $value = $term_of{ shift() };
Subroutine ordinal: not called CC=5 SCAR=34.0
486 0 my $max_trans = shift();
487  
488 # Load the necessary module, and compensate for its persnicketiness...
489 0 state $load = require Lingua::EN::Words2Nums;
490 0 ▶ local $SIG{__WARN__} = sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
491  
492 # Make sure we have a number...
493 0 ▶ $value = Lingua::EN::Words2Nums::words2nums($value) // $value;
Condition0%0/3
Lingua::EN::Words2Nums::words2nums($value) // $value
l!l&&r!l&&!r
000
MC/DC0%0/2
Lingua::EN::Words2Nums::words2nums($value) // $value
Lingua::EN::Words2Nums::words2nums($value) $value
Truth table0%0/3
A // B
A= Lingua::EN::Words2Nums::words2nums($value)B= $value
ABresult
1X1
011
000
494  
495 # If it's above threshold, return it as a number...
496 0 ▶ return $num2word_short_ordinal->($value)
Branch: 1 branch
BranchTrueFalseTotal
if defined $max_trans and $value >= $max_trans 0 0 0
Condition0%0/3
defined $max_trans and $value >= $max_trans
!ll&&!rl&&r
000
MC/DC0%0/2
defined $max_trans and $value >= $max_trans
defined $max_trans $value >= $max_trans
Truth table0%0/3
A and B
A= defined $max_transB= $value >= $max_trans
ABresult
0X0
100
111
497 if defined $max_trans && $value >= $max_trans;
498  
499 # Otherwise, convert it to words...
500 0 my $words = $num2word_ordinal->( $value );
501  
502 # Correct for proper English pronunciation...
503 0 ▶ if ($value > 100) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value > 100) 0 0 0
504 0 $words =~ s{ ($POWER_WORD) \s+ (\S*$LAST_WORD) \b } {$1 and $2}gx;
505 0 $words =~ s{ (?<! and ) \s+ (\S*$LAST_WORD) $ } { and $1}gx;
506 0 $words =~ s{ ^ ([^,]+),([^,]+) $ } {$1$2}x;
507 }
508  
509 0 return $words;
510 }
511  
512  
513 # Return a classical version of the term...
514 5028 ▶sub classical { Lingua::EN::Inflexion::Noun::Classical->new(shift) }
Subroutine classical: called CC=1 SCAR=0.0
515  
516  
517 package Lingua::EN::Inflexion::Noun::Classical;
518 32 our @ISA = 'Lingua::EN::Inflexion::Noun';
519  
520 # Inside-out ctor expects a base-class object to clone...
521 sub new {
522 5028 ▶ my ($class, $orig_object) = @_;
Subroutine new: called CC=2 SCAR=6.9
523  
524 5028 my $new_object = bless do{ \my $scalar }, $class;
525  
526 # Special case of "them" (because "it" -> "they" and "it -> "them" are ambiguous)...
527 $term_of{$new_object}
528 5028 ▶ = $term_of{$orig_object} eq 'them' ? $term_of{$orig_object}
Branch: 1 branch
BranchTrueFalseTotal
$term_of{$orig_object} eq 'them' ? : 1 5027 5028
529 : $orig_object->singular;
530  
531 # Otherwise...
532  
533 5028 return $new_object;
534 }
535  
536 # Already a classical noun, so this is now idempotent...
537 0 ▶sub classical { return shift }
Subroutine classical: not called CC=1 SCAR=6.9
538  
539 # Classical plurals are different...
540 sub plural {
541 4856 ▶ my $self = shift;
Subroutine plural: called CC=12 SCAR=32.5
542 4856 ▶ my $person = shift // 0;
Condition50%1/2
shift() // 0
l!l
04856
MC/DC0%0/1
shift() // 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
543  
544 4856 my $term = $term_of{$self};
545  
546 # Prepositions imply objective or possessive (or dative)...
547 4856 ▶ my $preposition = $term =~ s{ \A ( \s* $PREP_PAT \s+ ) }{}xi ? $1 : q{};
Branch: 1 branch
BranchTrueFalseTotal
$term =~ s/ \A ( \s* $PREP_PAT \s+ ) //xi ? : 0 4856 4856
548  
549  
550 return
551 $preposition ? $preposition
552 . $encase->( $term,
553 $noun_inflexion_of{objective }{lc $term}{plural}[$person]
554 // $noun_inflexion_of{possessive}{lc $term}{plural}[$person]
555 // $noun_inflexion_of{reflexive }{lc $term}{plural}[$person]
556 // $noun_inflexion_of{nominative}{lc $term}{plural}[$person]
557 // Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term,$person)
558 )
559 : $encase->( $term,
560 $noun_inflexion_of{nominative}{lc $term}{plural}[$person]
561 // $noun_inflexion_of{objective }{lc $term}{plural}[$person]
562 // $noun_inflexion_of{possessive}{lc $term}{plural}[$person]
563 4856 ▶ // $noun_inflexion_of{reflexive }{lc $term}{plural}[$person]
Branch: 1 branch
BranchTrueFalseTotal
$preposition ? : 0 4856 4856
Condition45%11/24
((($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
l!l&&r!l&&!r
000
(($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
000
($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
000
$noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
000
((($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
l!l&&r!l&&!r
4348130
(($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
3494813
($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
24104822
$noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]
l!l&&r!l&&!r
1684832
MC/DC0%0/5
((($noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
$noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
MC/DC0%0/5
((($noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] // $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]) // $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]) // Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
$noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person] $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person] Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
Truth table0%0/6
A // B // C // D // E
A= $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]B= $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]C= $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]D= $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]E= Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
Truth table83%5/6
A // B // C // D // E
A= $noun_inflexion_of{"nominative"}{lc $term}{"plural"}[$person]B= $noun_inflexion_of{"objective"}{lc $term}{"plural"}[$person]C= $noun_inflexion_of{"possessive"}{lc $term}{"plural"}[$person]D= $noun_inflexion_of{"reflexive"}{lc $term}{"plural"}[$person]E= Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term, $person)
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
564 // Lingua::EN::Inflexion::Nouns::convert_to_classical_plural($term,$person)
565 );
566 }
567  
568 package Lingua::EN::Inflexion::Verb;
569 32 our @ISA = 'Lingua::EN::Inflexion::Term';
570  
571 32 ▶use Lingua::EN::Inflexion::Verbs;
Subroutine BEGIN: called CC=1 SCAR=0.0
572  
573 # Utility sub that adjusts final consonants when they need to be doubled in inflexions...
574 my $truncate = sub {
575 144 ▶ my ($term) = @_;
Subroutine __ANON__: called CC=10 SCAR=31.7
576  
577 # Apply the first relevant transform...
578 144 ▶ $term =~ s{ ie \Z }{y}x
Branch: 1 branch
BranchTrueFalseTotal
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x or $term =~ s/ ([^e])e \Z /$1/x or $term =~ / er \Z /x or $term =~ s/ (.[bdghklmnprstz][o]([n])) \Z /$1/x or $term =~ s/ ([^aeiou][aeiouy]([bcdlgmnprstv])) \Z /$1$2/x or $term =~ s/ e \Z //x 108 36 144
Condition37%9/24
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x or $term =~ s/ ([^e])e \Z /$1/x or $term =~ / er \Z /x or $term =~ s/ (.[bdghklmnprstz][o]([n])) \Z /$1/x or $term =~ s/ ([^aeiou][aeiouy]([bcdlgmnprstv])) \Z /$1$2/x
l!l&&r!l&&!r
036108
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x or $term =~ s/ ([^e])e \Z /$1/x or $term =~ / er \Z /x or $term =~ s/ (.[bdghklmnprstz][o]([n])) \Z /$1/x
l!l&&r!l&&!r
00144
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x or $term =~ s/ ([^e])e \Z /$1/x or $term =~ / er \Z /x
l!l&&r!l&&!r
00144
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x or $term =~ s/ ([^e])e \Z /$1/x
l!l&&r!l&&!r
00144
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x
l!l&&r!l&&!r
00144
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x
l!l&&r!l&&!r
00144
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x
l!l&&r!l&&!r
00144
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x
l!l&&r!l&&!r
00144
MC/DC11%1/9
$term =~ s/ ie \Z /y/x or $term =~ s/ ue \Z /u/x or $term =~ s/ ([auy])e \Z /$1/x or $term =~ s/ ski \Z /ski/x or $term =~ s/ [^b]i \Z //x or $term =~ s/ ([^e])e \Z /$1/x or $term =~ / er \Z /x or $term =~ s/ (.[bdghklmnprstz][o]([n])) \Z /$1/x or $term =~ s/ ([^aeiou][aeiouy]([bcdlgmnprstv])) \Z /$1$2/x
$term =~ s/ ie \Z /y/x $term =~ s/ ue \Z /u/x $term =~ s/ ([auy])e \Z /$1/x $term =~ s/ ski \Z /ski/x $term =~ s/ [^b]i \Z //x $term =~ s/ ([^e])e \Z /$1/x $term =~ / er \Z /x $term =~ s/ (.[bdghklmnprstz][o]([n])) \Z /$1/x $term =~ s/ ([^aeiou][aeiouy]([bcdlgmnprstv])) \Z /$1$2/x
Truth table20%2/10
A or B or C or D or E or F or G or H or I
A= $term =~ s/ ie \Z /y/xB= $term =~ s/ ue \Z /u/xC= $term =~ s/ ([auy])e \Z /$1/xD= $term =~ s/ ski \Z /ski/xE= $term =~ s/ [^b]i \Z //xF= $term =~ s/ ([^e])e \Z /$1/xG= $term =~ / er \Z /xH= $term =~ s/ (.[bdghklmnprstz][o]([n])) \Z /$1/xI= $term =~ s/ ([^aeiou][aeiouy]([bcdlgmnprstv])) \Z /$1$2/x
ABCDEFGHIresult
1XXXXXXXX1
01XXXXXXX1
001XXXXXX1
0001XXXXX1
00001XXXX1
000001XXX1
0000001XX1
00000001X1
0000000011
0000000000
579 or $term =~ s{ ue \Z }{u}x
580 or $term =~ s{ ([auy])e \Z }{$1}x
581  
582 or $term =~ s{ ski \Z }{ski}x
583 or $term =~ s{ [^b]i \Z }{}x
584  
585 or $term =~ s{ ([^e])e \Z }{$1}x
586  
587 or $term =~ m{ er \Z }x
588 or $term =~ s{ (.[bdghklmnprstz][o]([n])) \Z }{$1}x
589  
590 or $term =~ s{ ([^aeiou][aeiouy]([bcdlgmnprstv])) \Z }{$1$2}x
591  
592 or $term =~ s{ e \Z }{}x;
593  
594 144 return $term;
595 32 };
596  
597 # Report status of verb...
598 sub is_plural {
599 221 ▶ my ($self) = @_;
Subroutine is_plural: called CC=1 SCAR=0.0
600 221 return Lingua::EN::Inflexion::Verbs::is_plural( $term_of{$self} );
601 }
602  
603 sub is_singular {
604 232 ▶ my ($self) = @_;
Subroutine is_singular: called CC=1 SCAR=0.0
605 232 return Lingua::EN::Inflexion::Verbs::is_singular( $term_of{$self} );
606 }
607  
608 sub is_present {
609 0 ▶ my ($self) = @_;
Subroutine is_present: not called CC=1 SCAR=6.9
610 0 return Lingua::EN::Inflexion::Verbs::is_present( $term_of{$self} );
611 }
612  
613 sub is_past {
614 0 ▶ my ($self) = @_;
Subroutine is_past: not called CC=1 SCAR=6.9
615 0 return Lingua::EN::Inflexion::Verbs::is_past( $term_of{$self} );
616 }
617  
618 sub is_pres_part {
619 0 ▶ my ($self) = @_;
Subroutine is_pres_part: not called CC=1 SCAR=6.9
620 0 return Lingua::EN::Inflexion::Verbs::is_pres_part( $term_of{$self} );
621 }
622  
623 sub is_past_part {
624 0 ▶ my ($self) = @_;
Subroutine is_past_part: not called CC=1 SCAR=6.9
625 0 return Lingua::EN::Inflexion::Verbs::is_past_part( $term_of{$self} );
626 }
627  
628 # Report part-of-speech...
629 0 ▶sub is_verb { 1 }
Subroutine is_verb: not called CC=1 SCAR=6.9
630  
631  
632 # Conversions...
633  
634 sub singular {
635 1007 ▶ my $self = shift;
Subroutine singular: called CC=10 SCAR=23.1
636 1007 ▶ my $person = shift // 0;
Condition100%2/2
shift() // 0
l!l
424583
MC/DC100%1/1
shift() // 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
637 1007 my $term = $term_of{$self};
638  
639 # Find the right inflexion...
640 1007 my $inflexion;
641  
642 # "To be" is special...
643 1007 ▶ if ($self =~ m{ \A (?: is | am | are ) \Z }x) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self =~ / \A (?: is | am | are ) \Z /x) { } 18 989 1007
elsif ($person == 3 or $person == 0) { } 713 276 989
644 18 ▶ return $person == 0 ? $term
Branch: 3 branches
BranchTrueFalseTotal
$person == 0 ? : 6 12 18
$person == 2 || !$self->is_singular ? : 4 8 12
$person == 1 ? : 4 4 8
Condition66%2/3
$person == 2 or not $self->is_singular
l!l&&r!l&&!r
408
MC/DC50%1/2
$person == 2 or not $self->is_singular
$person == 2 not $self->is_singular
Truth table66%2/3
A or not(B)
A= $person == 2B= not $self->is_singular
ABresult
1X1
011
000
645 : $person == 2 || !$self->is_singular ? 'are'
646 : $person == 1 ? 'am'
647 : 'is'
648 }
649  
650 # Third person uses the "notional" singular inflexion...
651 ▶ elsif ($person == 3 || $person == 0) {
Condition100%3/3
$person == 3 or $person == 0
l!l&&r!l&&!r
136577276
MC/DC100%2/2
$person == 3 or $person == 0
$person == 3 $person == 0
Truth table100%3/3
A or B
A= $person == 3B= $person == 0
ABresult
1X1
011
000
652 # Is it a known inflexion???
653 713 my $known = Lingua::EN::Inflexion::Verbs::convert_to_singular( $term );
654  
655 # Return with case-following...
656 713 ▶ return $encase->( $term, $known eq '_' ? $term : $known );
Branch: 1 branch
BranchTrueFalseTotal
$known eq '_' ? : 0 713 713
657 }
658  
659 # First and second person always use the uninflected (i.e. "notional "plural" form)...
660 else {
661 276 return plural($self);
662 }
663 }
664  
665 sub plural {
666 4464 ▶ my ($self) = @_;
Subroutine plural: called CC=2 SCAR=6.9
667 4464 my $term = $term_of{$self};
668  
669 # Is it a known inflexion???
670 4464 my $known = Lingua::EN::Inflexion::Verbs::convert_to_plural( $term );
671  
672 # Return with case-following...
673 4464 ▶ return $encase->( $term, $known eq '_' ? $term : $known );
Branch: 1 branch
BranchTrueFalseTotal
$known eq '_' ? : 1 4463 4464
674 }
675  
676 sub past {
677 1057 ▶ my ($self) = @_;
Subroutine past: called CC=3 SCAR=11.0
678 1057 my $term = $term_of{$self};
679 1057 my $root = $self->plural;
680  
681 # Is it a known inflexion???
682 1057 my $inflexion = Lingua::EN::Inflexion::Verbs::convert_to_past( $term );
683  
684 1057 ▶ if ($inflexion eq '_') {
Branch: 1 branch
BranchTrueFalseTotal
if ($inflexion eq "_") 48 1009 1057
685 48 $inflexion = Lingua::EN::Inflexion::Verbs::convert_to_past( $root );
686 }
687  
688 # Otherwise use the standard pattern...
689 1057 ▶ if ($inflexion eq '_') {
Branch: 1 branch
BranchTrueFalseTotal
if ($inflexion eq "_") 48 1009 1057
690 48 $inflexion = $truncate->($root) . 'ed';
691 }
692  
693 # Return with case-following...
694 1057 return $encase->( $term, $inflexion );
695 }
696  
697 sub pres_part {
698 1020 ▶ my ($self) = @_;
Subroutine pres_part: called CC=2 SCAR=6.9
699 1020 my $term = $term_of{$self};
700 1020 my $root = $self->plural;
701  
702 # Is it a known inflexion???
703 1020 my $inflexion = Lingua::EN::Inflexion::Verbs::convert_to_pres_part( $root );
704  
705 # Otherwise use the standard pattern...
706 1020 ▶ if ($inflexion eq '_') {
Branch: 1 branch
BranchTrueFalseTotal
if ($inflexion eq "_") 48 972 1020
707 48 $inflexion = $truncate->($root) . 'ing';
708 }
709  
710 # Return with case-following...
711 1020 return $encase->( $term, $inflexion );
712 }
713  
714 sub past_part {
715 1082 ▶ my ($self) = @_;
Subroutine past_part: called CC=2 SCAR=6.9
716 1082 my $term = $term_of{$self};
717 1082 my $root = $self->plural;
718  
719 # Is it a known inflexion???
720 1082 my $inflexion = Lingua::EN::Inflexion::Verbs::convert_to_past_part( $root );
721  
722 # Otherwise use the standard pattern...
723 1082 ▶ if ($inflexion eq '_') {
Branch: 1 branch
BranchTrueFalseTotal
if ($inflexion eq "_") 48 1034 1082
724 48 $inflexion = $truncate->($root) . 'ed';
725 }
726  
727 # Return with case-following...
728 1082 return $encase->( $term, $inflexion );
729 }
730  
731 sub indefinite {
732 0 ▶ my ($self, $count) = @_;
Subroutine indefinite: not called CC=3 SCAR=24.8
733 0 ▶ $count //= 1;
Condition0%0/2
$count //= 1
l!l
00
MC/DC0%0/1
$count //= 1
$count
Truth table0%0/2
A
A= $count
Aresult
11
00
734  
735 0 ▶ return $count == 1 ? $self->singular
Branch: 1 branch
BranchTrueFalseTotal
$count == 1 ? : 0 0 0
736 : $self->plural;
737 }
738  
739 sub as_regex {
740 0 ▶ my ($self) = @_;
Subroutine as_regex: not called CC=1 SCAR=6.9
741 0 my %seen;
742 0 my $pattern = join '|', map { quotemeta } reverse sort grep { !$seen{$_}++ }
743 ($self->singular, $self->plural,
744 $self->past, $self->past_part, $self->classical->pres_part);
745 0 return qr{$pattern}i;
746 }
747  
748  
749  
750  
751 package Lingua::EN::Inflexion::Adjective;
752 32 our @ISA = 'Lingua::EN::Inflexion::Term';
753  
754 # Load adjective tables, always taking first option...
755 32 my @adjectives = (
756 # Determiners...
757 'a' => 'some',
758 'an' => 'some',
759  
760 # Demonstratives...
761 'that' => 'those',
762 'this' => 'these',
763  
764 # Possessives...
765 'my' => 'our',
766 'your' => 'your',
767 'their' => 'their',
768 'her' => 'their',
769 'his' => 'their',
770 'its' => 'their',
771 );
772  
773 32 my (%adj_plural_of, %adj_singular_of, %adj_is_plural, %adj_is_singular);
774 32 ▶while (my ($sing, $plur) = splice @adjectives, 0, 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@adjectives, 0, 2)) 320 32 352
775 320 $adj_is_singular{$sing} = 1;
776 320 ▶ $adj_singular_of{$plur} //= $sing;
Condition66%2/3
$adj_singular_of{$plur} //= $sing
l!l&&r!l&&!r
1281920
MC/DC0%0/2
$adj_singular_of{$plur} //= $sing
$adj_singular_of{$plur} $sing
Truth table66%2/3
A //= B
A= $adj_singular_of{$plur}B= $sing
ABresult
1X1
011
000
777  
778 320 $adj_is_plural{$plur} = 1;
779 320 ▶ $adj_plural_of{$sing} //= $plur;
Condition33%1/3
$adj_plural_of{$sing} //= $plur
l!l&&r!l&&!r
03200
MC/DC0%0/2
$adj_plural_of{$sing} //= $plur
$adj_plural_of{$sing} $plur
Truth table33%1/3
A //= B
A= $adj_plural_of{$sing}B= $plur
ABresult
1X1
011
000
780 }
781  
782 32 my %adj_possessive_inflexion = (
783 # Term 0TH 1ST 2ND 3RD
784 'my' => { singular => [qw< my my your its >],
785 plural => [qw< our our your their >],
786 },
787 'your' => { singular => [qw< your my your its >],
788 plural => [qw< your our your their >],
789 },
790 'her' => { singular => [qw< her my your her >],
791 plural => [qw< their our your their >],
792 },
793 'his' => { singular => [qw< his my your his >],
794 plural => [qw< their our your their >],
795 },
796 'its' => { singular => [qw< its my your its >],
797 plural => [qw< their our your their >],
798 },
799 'our' => { singular => [qw< my my your its >],
800 plural => [qw< our our your their >],
801 },
802 'their' => { singular => [qw< its my your its >],
803 plural => [qw< their our your their >],
804 },
805 );
806  
807  
808 # Report part-of-speech...
809 0 ▶sub is_adj { 1 }
Subroutine is_adj: not called CC=1 SCAR=6.9
810  
811  
812 # Report number of adjective...
813 sub is_plural {
814 18 ▶ my ($self) = @_;
Subroutine is_plural: called CC=4 SCAR=15.2
815 18 my $term = $term_of{$self};
816 return $adj_is_plural{$term} || $adj_is_plural{lc $term}
817 18 ▶ || !$adj_is_singular{$term} && !$adj_is_singular{lc $term};
Condition55%5/9
$adj_is_plural{$term} || $adj_is_plural{lc $term} || !($adj_is_singular{$term} || $adj_is_singular{lc $term})
l!l&&r!l&&!r
6120
$adj_is_plural{$term} or $adj_is_plural{lc $term}
l!l&&r!l&&!r
6012
$adj_is_singular{$term} || $adj_is_singular{lc $term}
l!l&&r!l&&!r
0012
MC/DC0%0/4
$adj_is_plural{$term} || $adj_is_plural{lc $term} || !($adj_is_singular{$term} || $adj_is_singular{lc $term})
$adj_is_plural{$term} $adj_is_plural{lc $term} $adj_is_singular{$term} $adj_is_singular{lc $term}
Truth table40%2/5
A or B || not(C || D)
A= $adj_is_plural{$term}B= $adj_is_plural{lc $term}C= $adj_is_singular{$term}D= $adj_is_singular{lc $term}
ABCDresult
1XXX1
01XX1
00001
001X0
00010
818 }
819  
820 sub is_singular {
821 21 ▶ my ($self) = @_;
Subroutine is_singular: called CC=4 SCAR=15.2
822 21 my $term = $term_of{$self};
823 return $adj_is_singular{$term} || $adj_is_singular{lc $term}
824 21 ▶ || !$adj_is_plural{$term} && !$adj_is_plural{lc $term};
Condition55%5/9
$adj_is_singular{$term} || $adj_is_singular{lc $term} || !($adj_is_plural{$term} || $adj_is_plural{lc $term})
l!l&&r!l&&!r
9120
$adj_is_singular{$term} or $adj_is_singular{lc $term}
l!l&&r!l&&!r
9012
$adj_is_plural{$term} || $adj_is_plural{lc $term}
l!l&&r!l&&!r
0012
MC/DC0%0/4
$adj_is_singular{$term} || $adj_is_singular{lc $term} || !($adj_is_plural{$term} || $adj_is_plural{lc $term})
$adj_is_singular{$term} $adj_is_singular{lc $term} $adj_is_plural{$term} $adj_is_plural{lc $term}
Truth table40%2/5
A or B || not(C || D)
A= $adj_is_singular{$term}B= $adj_is_singular{lc $term}C= $adj_is_plural{$term}D= $adj_is_plural{lc $term}
ABCDresult
1XXX1
01XX1
00001
001X0
00010
825 }
826  
827  
828 # Conversions...
829  
830 sub singular {
831 49 ▶ my $self = shift;
Subroutine singular: called CC=7 SCAR=19.5
832 49 ▶ my $person = shift // 0;
Condition100%2/2
shift() // 0
l!l
1237
MC/DC100%1/1
shift() // 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
833  
834 49 my $term = $term_of{$self};
835  
836 49 my $singular;
837  
838 # Is it a composite possessive form???
839 49 ▶ if ($term =~ m{ \A (.*) 's? \Z }ixms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($term =~ / \A (.*) 's? \Z /imsx) { } 21 28 49
840 21 my $word = Lingua::EN::Inflexion::Noun->new($1);
841 21 ▶ $singular = $word->is_singular ? $term : $word->singular . q{'s};
Branch: 1 branch
BranchTrueFalseTotal
$word->is_singular ? : 5 16 21
842 }
843  
844 # Otherwise, it's either a known inflexion, or uninflected...
845 else {
846 $singular = $adj_possessive_inflexion{lc $term}{singular}[$person]
847 // $adj_singular_of{$term}
848 28 ▶ // $adj_singular_of{lc $term}
Condition77%7/9
(($adj_possessive_inflexion{lc $term}{"singular"}[$person] // $adj_singular_of{$term}) // $adj_singular_of{lc $term}) // $term
l!l&&r!l&&!r
2260
($adj_possessive_inflexion{lc $term}{"singular"}[$person] // $adj_singular_of{$term}) // $adj_singular_of{lc $term}
l!l&&r!l&&!r
2206
$adj_possessive_inflexion{lc $term}{"singular"}[$person] // $adj_singular_of{$term}
l!l&&r!l&&!r
1936
MC/DC0%0/4
(($adj_possessive_inflexion{lc $term}{"singular"}[$person] // $adj_singular_of{$term}) // $adj_singular_of{lc $term}) // $term
$adj_possessive_inflexion{lc $term}{"singular"}[$person] $adj_singular_of{$term} $adj_singular_of{lc $term} $term
Truth table60%3/5
A // B // C // D
A= $adj_possessive_inflexion{lc $term}{"singular"}[$person]B= $adj_singular_of{$term}C= $adj_singular_of{lc $term}D= $term
ABCDresult
1XXX1
01XX1
001X1
00011
00000
849 // $term;
850 }
851  
852 49 return $encase->($term, $singular);
853 }
854  
855 sub plural {
856 64 ▶ my $self = shift;
Subroutine plural: called CC=8 SCAR=20.8
857 64 ▶ my $person = shift // 0;
Condition100%2/2
shift() // 0
l!l
2143
MC/DC100%1/1
shift() // 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
858 64 my $term = $term_of{$self};
859 64 my $plural = $term;
860  
861 # Is it an unequivocally plural possessive form???
862 64 ▶ if ($term =~ m{ ' \Z }ixms) {
Branch: 2 branches
BranchTrueFalseTotal
if ($term =~ / ' \Z /imsx) { } 4 60 64
elsif ($term =~ / \A (.*) 's \Z /imsx) { } 17 43 60
863 4 return $term;
864 }
865 # Is it general possessive form???
866 elsif ($term =~ m{ \A (.*) 's \Z }ixms) {
867 17 my $word = Lingua::EN::Inflexion::Noun->new($1);
868 17 ▶ $plural = $word->is_plural() ? $term : $word->plural . q{'s};
Branch: 1 branch
BranchTrueFalseTotal
$word->is_plural ? : 1 16 17
869 17 $plural =~ s{ s's \Z }{s'}xms
870 }
871  
872 # Otherwise, it's either a known inflexion, or uninflected...
873 else {
874 $plural = $adj_possessive_inflexion{lc $term}{plural}[$person]
875 // $adj_plural_of{$term}
876 43 ▶ // $adj_plural_of{lc $term}
Condition77%7/9
(($adj_possessive_inflexion{lc $term}{"plural"}[$person] // $adj_plural_of{$term}) // $adj_plural_of{lc $term}) // $term
l!l&&r!l&&!r
3760
($adj_possessive_inflexion{lc $term}{"plural"}[$person] // $adj_plural_of{$term}) // $adj_plural_of{lc $term}
l!l&&r!l&&!r
3706
$adj_possessive_inflexion{lc $term}{"plural"}[$person] // $adj_plural_of{$term}
l!l&&r!l&&!r
3346
MC/DC0%0/4
(($adj_possessive_inflexion{lc $term}{"plural"}[$person] // $adj_plural_of{$term}) // $adj_plural_of{lc $term}) // $term
$adj_possessive_inflexion{lc $term}{"plural"}[$person] $adj_plural_of{$term} $adj_plural_of{lc $term} $term
Truth table60%3/5
A // B // C // D
A= $adj_possessive_inflexion{lc $term}{"plural"}[$person]B= $adj_plural_of{$term}C= $adj_plural_of{lc $term}D= $term
ABCDresult
1XXX1
01XX1
001X1
00011
00000
877 // $term;
878 }
879  
880 60 return $encase->($term, $plural);
881 }
882  
883  
884 32 1; # Magic true value required at end of module
885 __END__
« Inflexion/Indefinite.pm ↑ Summary Inflexion/Verbs.pm »