Acme-Lou

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

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

README.md  view on Meta::CPAN

# 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 )