line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Ikamusume; |
2
|
3
|
|
|
3
|
|
3143
|
use 5.008001; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
125
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
104
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
152
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
6
|
3
|
|
|
3
|
|
27
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
279
|
|
7
|
3
|
|
|
3
|
|
2860
|
use Class::Trigger; |
|
3
|
|
|
|
|
4491
|
|
|
3
|
|
|
|
|
45
|
|
8
|
3
|
|
|
3
|
|
2640
|
use File::ShareDir; |
|
3
|
|
|
|
|
20719
|
|
|
3
|
|
|
|
|
185
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
1742
|
use Acme::Ikamusume::MAParser; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Acme::Ikamusume::Rule; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
|
|
|
|
|
|
my $self = bless {}, shift; |
15
|
|
|
|
|
|
|
Acme::Ikamusume::Rule->set_rules($self); |
16
|
|
|
|
|
|
|
$self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub geso { |
20
|
|
|
|
|
|
|
my ($self, $input) = @_; |
21
|
|
|
|
|
|
|
return "" unless defined $input; |
22
|
|
|
|
|
|
|
$self = $self->new unless ref $self; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $parser = Acme::Ikamusume::MAParser->new({ |
25
|
|
|
|
|
|
|
userdic => File::ShareDir::dist_file('Acme-Ikamusume', 'ika.dic'), |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my @result; |
29
|
|
|
|
|
|
|
for my $text (split /(\s+)/, $input) { |
30
|
|
|
|
|
|
|
if ($text =~ /\s/) { |
31
|
|
|
|
|
|
|
push @result, $text; |
32
|
|
|
|
|
|
|
next; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @words; |
36
|
|
|
|
|
|
|
foreach ( |
37
|
|
|
|
|
|
|
my $node = $parser->parse($text); |
38
|
|
|
|
|
|
|
$node; |
39
|
|
|
|
|
|
|
$node = $node->next |
40
|
|
|
|
|
|
|
) { |
41
|
|
|
|
|
|
|
next if $node->stat =~ /[23]/; # skip MECAB_(BOS|EOS)_NODE |
42
|
|
|
|
|
|
|
push @words, $node->surface; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->call_trigger('node' => ($node, \@words)); |
45
|
|
|
|
|
|
|
$self->call_trigger('node.has_extra' => ($node, \@words)) if $node->features->{extra}; |
46
|
|
|
|
|
|
|
$self->call_trigger('node.readable' => ($node, \@words)) if $node->features->{yomi}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
push @result, @words; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
join "", @result; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
__END__ |