Tool/EnglishMorpho/exceptions/nouns_irregular.pl untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 32 CC 4 SCAR 22.6
CC
4
Cov
0%
generate
12.0
analyze
6.0
CRAP 9.6
1 #!/usr/bin/env perl
2 my $DATA = <<'END_DATA';
3 basis bases
4 brother brothers #1 regular
5 brother brethen #2
6 calf calves
7 elf elves
8 fig. figs.
9 foot feet
10 goose geese
11 grandchild grandchildren
12 grouse grouse
13 half halves
14 hoof hoofs #1 regular
15 hoof hooves #2
16 child children
17 knife knives
18 leaf leaves
19 life lives
20 loaf loaves
21 louse lice
22 man men
23 money monies
24 moose moose
25 mouse mice
26 no. nos.
27 ox oxen
28 passer-by passers-by
29 penny pence
30 runner-up runners-up
31 scarf scarfs #1 regular
32 scarf scarves #2
33 self selves
34 sheaf sheaves
35 shelf shelves
36 thief thieves
37 tooth teeth
38 wife wives
39 wolf wolves
40 woman women
41 bureau bureaux
42 kubbitz kibbutzim
43 lira lire
44 END_DATA
45  
46 sub analyze() { ## no critic qw(Subroutines::ProhibitSubroutinePrototypes)
47 foreach my $line ( split( "\n", $DATA ) ) {
48 next if $line =~ /regular$/;
49 my ( $singular, $plural ) = split( /\s+/, $line );
50 print "$plural\tNNS\t$singular\n";
51 }
52 return;
53 }
54  
55 sub generate() { ## no critic qw(Subroutines::ProhibitSubroutinePrototypes)
56 foreach my $line ( split( "\n", $DATA ) ) {
57 next if $line =~ /regular$/;
58 next if $line =~ /#2$/;
59 print "$line\n";
60 }
61 return;
62 }
63  
64 if ( $ARGV[0] eq '-a' ) { analyze(); }
65 elsif ( $ARGV[0] eq '-g' ) { generate(); }
66 elsif ( $ARGV[0] eq '-d' ) { print $DATA; }
67 else { die "Invalid usage: use option -a, -g or -d\n"; }