Acme-Lou
view release on metacpan or search on metacpan
README.md
author/Makefile
author/en2kana.csv
author/ja2kana.csv
author/ja2kana.pl
author/lou.csv
author/loucsv.pl
cpanfile
lib/Acme/Lou.pm
share/euc-jp.dic
share/utf8.dic
t/00_compile.t
t/01_translate.t
t/02_rate.t
t/03_export.t
META.yml
MANIFEST
# NAME
Acme::Lou - Let's together with Lou Ohshiba
# SYNOPSIS
use utf8;
use Acme::Lou qw/lou/;
print lou("人çã«ã¯ã大åãªä¸ã¤ã®è¢ãããã¾ãã");
# => ã©ã¤ãã«ã¯ãã¤ã³ãã¼ã¿ã³ããªä¸ã¤ã®ããã°ãããã¾ãã
# DESCRIPTION
Translate Japanese text into Lou Ohshiba (Japanese comedian) style.
# METHODS
author/Makefile view on Meta::CPAN
INDEXER:=/usr/local/libexec/mecab/mecab-dict-index
DICDIR:=/usr/local/lib/mecab/dic/ipadic
help:
make -C author share
csv:
cat mecab-ipadic-2.7.0-20060707/*.csv | perl loucsv.pl > lou.csv
share:
$(INDEXER) -d $(DICDIR) -t euc-jp -u ../share/euc-jp.dic -f utf8 lou.csv
$(INDEXER) -d $(DICDIR) -t utf8 -u ../share/utf8.dic -f utf8 lou.csv
author/ja2kana.pl view on Meta::CPAN
use strict;
use utf8;
use Fatal qw(open close);
use FindBin qw($Bin);
use Encode;
my %en2kana;
open my $en2kana, '<:encoding(utf8)', "$Bin/lou-en2kana.csv";
while (<$en2kana>) {
chomp;
next unless $_;
next if /^#/;
my ($en, $kana) = split ',';
$en2kana{lc $en} = $kana;
}
my %skip_word = map { $_ => 1 } qw(
now say new be come see is as
one two three four five
six seven eight nine ten
law raw row whole weigh
hurt hut firm fare flesh
youth lack role waste worth
few pray health sex
);
warn "make $Bin/lou-ja2kana.csv...\n";
open my $ja2kana, '>:encoding(utf8)', "$Bin/lou-ja2kana.csv";
print {$ja2kana} <<'HEADER';
# lou-ja2kana.csv
# Copyright 2007 Naoki Tomita <tomita@cpan.org>
# License: GPL
#
# This dictionary is based on the following resource.
# - lou-en2kana.csv (Acme::Lou)
# - edict
# Copyright (C) 2006 The Electronic Dictionary Research
author/loucsv.pl view on Meta::CPAN
use strict;
use warnings;
use utf8;
use open OUT => qw/:utf8 :std/;
use autodie;
use Encode;
use FindBin;
=head1 USAGE
useage:
cat mecab-ipadic-2.7.0-20060707/*.csv | perl loucsv.pl > lou.csv
original:
lib/Acme/Lou.pm view on Meta::CPAN
package Acme::Lou;
use 5.010001;
use strict;
use warnings;
use utf8;
our $VERSION = '0.04';
use Exporter 'import';
use Encode;
use File::ShareDir qw/dist_file/;
use Text::Mecabist;
our @EXPORT_OK = qw/lou/;
sub lou {
lib/Acme/Lou.pm view on Meta::CPAN
__END__
=encoding utf-8
=head1 NAME
Acme::Lou - Let's together with Lou Ohshiba
=head1 SYNOPSIS
use utf8;
use Acme::Lou qw/lou/;
print lou("人çã«ã¯ã大åãªä¸ã¤ã®è¢ãããã¾ãã");
# => ã©ã¤ãã«ã¯ãã¤ã³ãã¼ã¿ã³ããªä¸ã¤ã®ããã°ãããã¾ãã
=head1 DESCRIPTION
Translate Japanese text into Lou Ohshiba (Japanese comedian) style.
=head1 METHODS
t/01_translate.t view on Meta::CPAN
use strict;
use utf8;
use Test::Base;
plan tests => 1 * blocks;
use Acme::Lou;
my $lou = Acme::Lou->new;
run {
my $block = shift;
t/02_rate.t view on Meta::CPAN
use strict;
use utf8;
use Test::More;
use Acme::Lou;
my $lou = Acme::Lou->new;
is(
$lou->translate('ä»å¹´ããããããé¡ããããã¾ãã', { lou_rate => 0 }),
'ä»å¹´ããããããé¡ããããã¾ãã',
'lou_rate = 0'
t/03_export.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Acme::Lou qw/lou/;
my $input = <<'...';
ç¥åç²¾èã®éã®å£°ã諸è¡ç¡å¸¸ã®é¿ãããã
æ²ç¾
忍¹ã®è±ã®è²ãçè
å¿
è¡°ã®çãç¾ãã
奢ãã人ãä¹
ããããã坿¥ã®å¤ã®å¤¢ã®ãã¨ãã
- ã平家ç©èªã
...
( run in 1.169 second using v1.01-cache-2.11-cpan-49f99fa48dc )