Acme-AjiFry

 view release on metacpan or  search on metacpan

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


        my $consonant;
        if ( $ajifry_word =~ s/^(食え|フライ|お刺身|アジ|ドボ|山岡|岡星|ゴク・・・|ゴク・・・|ゴク…|ああ|雄山)//
          )
        {
            $consonant = $1;
        }
        unless ($consonant) {
            $ajifry_word =~ s/^(.)//;
            $translated_word .= $1;
            next;
        }
        my $vowel;
        if ( $ajifry_word =~ s/^(食え食え|ドボドボ|お刺身|むむ・・・|むむ・・・|むむ…|アジフライ)//
          )
        {
            $vowel = $1;
        }
        unless ($vowel) {
            $translated_word .= $consonant;
            $ajifry_word =~ s/^(.)//;
            $translated_word .= $1;
            next;
        }

        my $is_dullness;
        $is_dullness = $1 if $ajifry_word =~ s/^(陶人)//;
        my $is_p_sound;
        $is_p_sound = $1 if $ajifry_word =~ s/^(社主)//;

        $consonant = $self->_get_consonant_by_ajifry_word($consonant);
        $vowel     = $self->_get_vowel_by_ajifry_word($vowel);

        my @match_characters =
          $self->_find_duplicate_element_in_both_lists( ROWS->{$consonant},
            COLS->{$vowel} );
        if ($is_p_sound) {
            $translated_word .= $match_characters[2];
        }
        elsif ($is_dullness) {
            $translated_word .= $match_characters[1];
        }
        elsif ( $is_double_consonant && $consonant eq 't' ) {
            $translated_word .= $match_characters[2];
        }
        elsif ($is_double_consonant) {
            $translated_word .= $match_characters[1];
        }
        else {
            $translated_word .= $match_characters[0];
        }
    }

    return $translated_word;
}

1;

__END__

=encoding utf8

=head1 NAME

Acme::AjiFry - AjiFry Language (アジフライ語) Translator


=head1 VERSION

This document describes Acme::AjiFry version 0.09


=head1 SYNOPSIS

    use Acme::AjiFry;

    my $ajifry = Acme::AjiFry->new();

    print $ajifry->to_AjiFry('おさしみ')."\n"; # outputs => "食えアジフライお刺身食え食えお刺身ドボドボ岡星ドボドボ"
    print $ajifry->to_Japanese('食えアジフライお刺身食え食えお刺身ドボドボ岡星ドボドボ')."\n"; # outputs => "おさしみ"


=head1 DESCRIPTION

Acme::AjiFry is the AjiFry-Language translator.
This module can translate Japanese into AjiFry-Language, and vice versa.
If you would like to know about AjiFry-Language, please refer to the following web site (Japanese Web Site).
L<http://ja.uncyclopedia.info/wiki/%E3%82%A2%E3%82%B8%E3%83%95%E3%83%A9%E3%82%A4%E8%AA%9E>

=head1 METHODS

=over

=item new

new is the constructor of this module.

=item to_Japanese

This function needs a AjiFry-Language string as parameter.
It returns Japanese which was translated from AjiFry-Language.

=item to_AjiFry

This function needs a string as parameter.
It returns AjiFry-Language which was translated from Japanese.

=back

=head1 DEPENDENCIES

=over 4

=item * Encode (version 2.39 or later)

=back


=head1 BUGS AND LIMITATIONS

=for author to fill in:



( run in 2.092 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )