Acme-Ikamusume

 view release on metacpan or  search on metacpan

lib/Acme/Ikamusume.pm  view on Meta::CPAN

        
            my $latest = join "",
                $node->prev && $node->prev->text,
                $node->text;
            if ($latest =~ /(?:ゲソ|イー?カ)$/) {
                return;
            }
            
            $node->text($node->text . 'でゲソ');
        }
        
        if ($node->is('動詞') and
            $node->inflection_form =~ '基本形' and
            $next->pos =~ /^助詞/) {
            $node->text($node->text . 'でゲソ');
        }
    },
    
    # EBI: accent
    sub {
        my $node = shift;
        my $text = $node->text;
        my @ebi_accent = qw(! ♪ ♪ ♫ ♬ ♡);
        
        $text =~ s{(エビ|えび|海老)}{
            $1 . $ebi_accent[ int rand scalar @ebi_accent ];
        }e;
        
        $node->text($text);
    },
);

sub apply_rules {
    my ($self, $node) = @_;
    for my $rule (@rules) {
        $rule->($node);
    }
}

1;
__END__

=encoding utf-8

=head1 NAME

Acme::Ikamusume - The invader comes from the bottom of the sea!

=head1 SYNOPSIS

  use utf8;
  use Acme::Ikamusume;

  print Acme::Ikamusume->geso('イカ娘です。あなたもperlで侵略しませんか?');
  # => イカ娘でゲソ。お主もperlで侵略しなイカ?

=head1 DESCRIPTION

Acme::Ikamusume converts Japanese text into like Ikamusume speak.
Ikamusume, meaning "Squid-Girl", she is a cute Japanese comic/manga
character (L<http://www.ika-musume.com/>).

Try this module here: L<http://ika.koneta.org/>. enjoy!

=head1 METHODS

=over 4

=item $output = Acme::Ikamusume->geso( $input )

=back

=head1 AUTHOR

Naoki Tomita E<lt>tomita@cpan.orgE<gt>

=head1 LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut



( run in 0.908 second using v1.01-cache-2.11-cpan-d80b1682f3f )