Acme::Lou - Let's together with Lou Ohshiba
use utf8; use Acme::Lou; my $lou = new Acme::Lou; my $text = "「美しい国、日本」"; print $lou->translate($text); # 「ビューティフルな国、ジャパン」
Mr. Lou Ohshiba is a Japanese comedian. This module translates text/HTML into his style.
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,
euc-jp
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->translate()
lou_rate: 100 is_html: 0 html_fx_rate: 0
Return translated text in Lou Ohshiba style. translate() expect utf-8 byte or utf8 flagged text, and it return utf-8 flaged text.
translate()
%options: (overwrite global options)
Set percentage of translating. 100 means full translating, 0 means do nothing.
If $text is a HTML, you should set true. Acme::Lou makes a fine job with HTML::Parser. Default is false.
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>
Naoki Tomita <tomita@cpan.org>
Special thanks to Taku Kudo
This program is released under the following license: GPL
http://e8y.net/labs/lou_trans/, http://mecab.sourceforge.jp/
To install Acme::Lou, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Acme::Lou
CPAN shell
perl -MCPAN -e shell install Acme::Lou
For more information on module installation, please visit the detailed CPAN module installation guide.