line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
19
|
use 5.012; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Lingua::Poetry::Haiku::Finder::Word; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
1
|
|
|
1
|
|
314
|
use Types::Standard -types; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
12
|
1
|
|
|
1
|
|
5508
|
use Lingua::EN::Syllable 'syllable'; |
|
1
|
|
|
|
|
586
|
|
|
1
|
|
|
|
|
63
|
|
13
|
1
|
|
|
1
|
|
535
|
use Lingua::EN::Numbers 'num2en'; |
|
1
|
|
|
|
|
2196
|
|
|
1
|
|
|
|
|
68
|
|
14
|
1
|
|
|
1
|
|
13
|
use namespace::autoclean; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has text => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => Str, |
19
|
|
|
|
|
|
|
required => !!1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has syllables => ( |
23
|
|
|
|
|
|
|
is => 'lazy', |
24
|
|
|
|
|
|
|
isa => Int, |
25
|
|
|
|
|
|
|
init_arg => undef, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _build_syllables { |
29
|
3956
|
|
|
3956
|
|
318606
|
my ( $self ) = ( shift ); |
30
|
3956
|
|
|
|
|
13795
|
my @parts = split /-/, $self->text; |
31
|
3956
|
|
|
|
|
7322
|
my $sum = 0; |
32
|
3956
|
|
|
|
|
8867
|
while ( @parts ) { |
33
|
4056
|
|
|
|
|
19295
|
my $part = shift @parts; |
34
|
4056
|
100
|
|
|
|
16521
|
if ( $part =~ /^(16|17|18|19|20)([1-9][0-9])$/ ) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# looks like a year |
36
|
4
|
|
|
|
|
22
|
unshift @parts, $1, $2; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
elsif ( $part =~ /^(16|17|18|19)0([1-9])$/ ) { |
39
|
|
|
|
|
|
|
# also looks like a year |
40
|
0
|
|
|
|
|
0
|
unshift @parts, $1, 'oh', $2; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif ( $part =~ /^[0-9]+$/ ) { |
43
|
|
|
|
|
|
|
# numbers in general |
44
|
54
|
|
|
|
|
326
|
unshift @parts, split / /, num2en( $part ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
3998
|
|
|
|
|
10276
|
$sum += syllable( $part ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
3956
|
|
|
|
|
905860
|
return $sum; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
40
|
|
|
40
|
0
|
106
|
sub is_word { !!1 } |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
with 'Lingua::Poetry::Haiku::Finder::SentencePart'; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |