line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::EN::Inflect::Number; |
2
|
|
|
|
|
|
|
$Lingua::EN::Inflect::Number::VERSION = '1.12'; |
3
|
1
|
|
|
1
|
|
16053
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
64
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(to_PL to_S number); |
10
|
1
|
|
|
1
|
|
745
|
use Lingua::EN::Inflect qw(PL PL_N_eq); |
|
1
|
|
|
|
|
22361
|
|
|
1
|
|
|
|
|
349
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
13
|
1
|
|
|
1
|
|
10
|
my ($self, @syms) = @_; |
14
|
|
|
|
|
|
|
# Grep out the ones we provide: |
15
|
1
|
|
|
|
|
4
|
my $provide = join "|", map quotemeta, @EXPORT_OK; |
16
|
1
|
|
|
|
|
2
|
my @new_syms; |
17
|
1
|
|
|
|
|
2
|
for my $sym (@syms) { |
18
|
4
|
100
|
|
|
|
48
|
if ($sym =~ /^\&?($provide)$/) { |
19
|
3
|
|
|
|
|
251
|
$self->export_to_level(1, $self, $sym); |
20
|
|
|
|
|
|
|
} else { |
21
|
1
|
|
|
|
|
3
|
push @new_syms, $sym; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
1
|
50
|
|
|
|
3
|
return unless @new_syms; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Pretend we don't exist |
27
|
1
|
|
|
|
|
3
|
@_ = ("Lingua::EN::Inflect", @new_syms); |
28
|
1
|
|
|
|
|
1267
|
goto &Exporter::import; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub to_PL { |
32
|
8
|
|
|
8
|
1
|
1489
|
my $word = shift; |
33
|
8
|
|
|
|
|
13
|
my $num = number($word); |
34
|
8
|
100
|
100
|
|
|
47
|
return $word if $num eq "ambig" or $num eq "p"; |
35
|
3
|
|
|
|
|
7
|
return PL($word); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub to_S { |
39
|
8
|
|
|
8
|
1
|
1974
|
my $word = shift; |
40
|
8
|
|
|
|
|
11
|
my $num = number($word); |
41
|
8
|
100
|
100
|
|
|
47
|
return $word if $num eq "ambig" or $num eq "s"; |
42
|
3
|
|
|
|
|
8
|
return PL($word); # I don't know why this works, but it seems to. |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub number { |
46
|
19
|
|
|
19
|
1
|
540
|
my $word = shift; |
47
|
19
|
|
|
|
|
44
|
my $test = PL_N_eq($word, PL($word)); |
48
|
19
|
|
|
|
|
9670
|
$test =~ s/:.*//; |
49
|
19
|
100
|
|
|
|
45
|
$test = "ambig" if $test eq "eq"; |
50
|
19
|
|
|
|
|
30
|
return $test; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |