File Coverage

blib/lib/Acme/Ikamusume/MAParser.pm
Criterion Covered Total %
statement 18 23 78.2
branch n/a
condition 0 2 0.0
subroutine 6 8 75.0
pod n/a
total 24 33 72.7


line stmt bran cond sub pod time code
1             package Acme::Ikamusume::MAParser;
2 3     3   19 use strict;
  3         6  
  3         107  
3 3     3   18 use warnings;
  3         7  
  3         87  
4 3     3   3152 use Encode;
  3         37368  
  3         300  
5              
6 3     3   28 use base 'Text::MeCab';
  3         6  
  3         846  
7              
8             my $encoding = Encode::find_encoding( Text::MeCab::ENCODING );
9              
10             sub parse {
11 0     0     shift->SUPER::parse($encoding->encode(@_));
12             }
13              
14             package # hide from the PAUSE indexer
15             Text::MeCab::Node;
16              
17             {
18 2     2   13 no strict 'refs';
  2         5  
  2         58  
19 2     2   11 no warnings 'redefine';
  2         4  
  2         561  
20             for my $method (qw( surface feature )) {
21             my $original = \&$method;
22             *{$method} = sub {
23             my $val = $original->(@_);
24             defined $val ? $encoding->decode($val) : "";
25             };
26             }
27             }
28              
29             sub features {
30 0     0     my %f;
31            
32 0           @f{qw(
33             pos category1 category2 category3
34             inflect inflect_type original yomi pronounse
35             extra
36             )} = split(/,/, shift->feature, 10);
37            
38 0   0       $f{extra} = [ split /,/, $f{extra} || "" ];
39            
40 0           \%f;
41             };
42              
43             1;
44             __END__