| Acme::Lou - Let's together with Lou Ohshiba |
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...
Your MeCab dictionary charset. Default is euc-jp. If you compiled
mecab with utf-8,
my $lou = new Acme::Lou({ mecab_charset => 'utf-8' });
Optional. Arguments for MeCab::Tagger instance.
my $lou = new Acme::Lou({
mecab_option => ["-d /path/to/yourdic"],
});
You can set your own MeCab::Tagger instance, if you want. Optional.
These are global options for $lou->translate() (See below).
Default is
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.
%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/
| Acme::Lou - Let's together with Lou Ohshiba |