Acme-Samurai

 view release on metacpan or  search on metacpan

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

            }
        }
    }
    
    if ($node->is('感動詞')) {
        if ($node->next and
            $node->next->pos !~ /詞/) {
            $text = $node->extra if $node->extra;
            $text .= 'でござる';
        }
    }

    $node->text($text);
}

sub finalize {
    my ($self, $doc) = @_;
    my $text = $doc->join('text');
    $text =~ s/(?:ておりまする|ていまする?)\b/ており候/g;
    $text =~ s/(?:どうも)?かたじけない(?:ございま(?:する|す|した))?/かたじけない/g;
    $text;
}

1;
__END__

=encoding utf-8

=head1 NAME

Acme::Samurai - Speak like a Samurai

=head1 SYNOPSIS

  use utf8;
  use Acme::Samurai;

  Acme::Samurai->gozaru("私、侍です"); # => "それがし、侍でござる"

=head1 DESCRIPTION

Translates Japanese to 時代劇
(L<http://en.wikipedia.org/wiki/Jidaigeki>) speak.

Test form: L<http://samurai.koneta.org/>

=head1 METHODS

=over 4

=item gozaru( $text )

=back

=head1 AUTHOR

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

=head1 SPECIAL THANKS

kazina, this module started from てきすたー dictionary.
L<http://kazina.com/texter/index.html>

and Hiroko Nagashima, Shin Yamauchi for addition samurai vocabulary.

=head1 LICENSE

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

=for stopwords hiroko nagashima shin yamauchi de gozaru kazina

=cut



( run in 3.023 seconds using v1.01-cache-2.11-cpan-f56aa216473 )