The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::Lou - Let's together with Lou Ohshiba

SYNOPSIS

    use utf8;
    use Acme::Lou;
    
    my $lou = new Acme::Lou;
    
    my $text = "「美しい国、日本」";
    print $lou->translate($text); # 「ビューティフルな国、ジャパン」

DESCRIPTION

Mr. Lou Ohshiba is a Japanese comedian. This module translates text/HTML into his style.

METHODS

$lou = Acme::Lou->new([ \%options ])
$lou = Acme::Lou->new([ %options ])

Creates an Acme::Lou object.

%options can take...

  • mecab_charset

    Your MeCab dictionary charset. Default is euc-jp. If you compiled mecab with utf-8,

        my $lou = new Acme::Lou({ mecab_charset => 'utf-8' });
  • mecab_option

    Optional. Arguments for MeCab::Tagger instance.

        my $lou = new Acme::Lou({ 
            mecab_option => ["-d /path/to/yourdic"],
        });
  • mecab

    You can set your own MeCab::Tagger instance, if you want. Optional.

  • lou_rate

  • is_html

  • html_fx_rate

    These are global options for $lou->translate() (See below). Default is

        lou_rate: 100
        is_html: 0
        html_fx_rate: 0
$lou->translate($text [, \%options ])

Return translated text in Lou Ohshiba style. translate() expect utf-8 byte or utf8 flagged text, and it return utf-8 flaged text.

%options: (overwrite global options)

  • lou_rate

    Set percentage of translating. 100 means full translating, 0 means do nothing.

  • is_html

    If $text is a HTML, you should set true. Acme::Lou makes a fine job with HTML::Parser. Default is false.

  • html_fx_rate

    Set percentage of HTML style decoration. Default is 0. When html_fx_rate is set, using HTML::Parser automatically. (not need to set is_html)

        my $html = <<'HTML';
        <html>
        <body>
        今年もよろしくお願いいたします
        </body>
        </html>
        HTML
        ;
        
        $html = $lou->translate($html, {
            lou_rate => 100,
            html_fx_rate => 50,
        });
        
        # <html>
        # <body>
        # <FONT color=#003399 size=5>ディスイヤー</FONT>もよろしくプリーズいたします
        # </body>
        # </html>

AUTHOR

Naoki Tomita <tomita@cpan.org>

Special thanks to Taku Kudo

LICENSE

This program is released under the following license: GPL

SEE ALSO

http://e8y.net/labs/lou_trans/, http://mecab.sourceforge.jp/