Skip to content

Commit

Permalink
add IKA eos rule
Browse files Browse the repository at this point in the history
  • Loading branch information
tomill committed Dec 15, 2010
1 parent 8a53334 commit 6c559ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/Acme/Ikamusume/Rule.pm
Expand Up @@ -27,13 +27,6 @@ our @EBI_ACCENT = qw(! ♪ ♪ ♫ ♬ ♡);

sub rules {

# # debug
# 'node' => sub {
# my ($self, $node, $words) = @_;
# use YAML;
# warn Dump [ $node->surface, $node->features ];
# },

# use userdic extra field
'node.has_extra' => sub {
my ($self, $node, $words) = @_;
Expand Down Expand Up @@ -178,8 +171,7 @@ sub rules {
NEXT;
},


# GESO: eos
# GESO/IKA: eos
'node.readable' => sub {
my ($self, $node, $words) = @_;
if ($node->next->stat == 3 or # MECAB_EOS_NODE
Expand All @@ -191,6 +183,14 @@ sub rules {
if ($node->features->{pos} =~ /^(?:その他|記号|助詞|接頭詞|接続詞|連体詞)/) {
return NEXT;
}

if ($node->features->{pos} eq '助動詞' and
$words->[PREV] eq 'じゃ' and
$node->surface eq 'ない') {
$words->[CURR] = 'なイカ';
return NEXT;
}

if ($node->features->{pos} =~ /^助動詞/ and
$words->[PREV] =~ /(?:ゲソ|イー?カ)/) {
return NEXT;
Expand Down
8 changes: 8 additions & 0 deletions t/01_geso.t
Expand Up @@ -396,6 +396,14 @@ __DATA__
--- expected: 恐るべき、
=== IKA: eos NAI
--- input: そうじゃない
--- expected: そうじゃなイカ
=== IKA: eos NAI
--- input: いいんじゃない?
--- expected: いいんじゃなイカ?
=== HTML tweak
--- input: <p>君に届け</p>
--- expected: <p>お主に届けでゲソ</p>
Expand Down

0 comments on commit 6c559ba

Please sign in to comment.