Acme-Pinoko

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    Acme::Pinoko - Acchonburike!

SYNOPSIS
      use Acme::Pinoko;
      use utf8;

      my $pinoko = Acme::Pinoko->new(%config);
      print $pinoko->say('ピノコ18のレディなのよ');
      # -> ピノコ18のレレイなのよさ

DESCRIPTION
    Acme::Pinoko converts standard Japanese text to Pinoko-ish Japanese
    text.

    Pinoko is a Japanese manga character. She speaks with a lisp and

benchmark/pinoko_vs_geso.pl  view on Meta::CPAN

#!/usr/bin/env perl

use strict;
use warnings;
use utf8;
use Acme::Pinoko;
#use Acme::Ikamusume; # Acme::Ikamusume invades Text::MeCab globally
use Benchmark qw/cmpthese timethese/;
use open qw/:utf8 :std/;


my $kytea_pinoko = Acme::Pinoko->new(parser => 'Text::KyTea');
my $mecab_pinoko = Acme::Pinoko->new(parser => 'Text::MeCab');

my $text ='おはようございます。ピノコ' x 10;

cmpthese(
    timethese(-1, {
        'kytea_pinoko'  => \&kytea_pinoko,

inc/Module/Install/ReadmeFromPod.pm  view on Meta::CPAN

  return $out_file;
}


sub _readme_htm {
  my ($self, $in_file, $out_file, $options) = @_;
  $out_file ||= 'README.htm';
  require Pod::Html;
  Pod::Html::pod2html(
    "--infile=$in_file",
    "--outfile=$out_file",
    @$options,
  );
  # Remove temporary files if needed
  for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
    if (-e $file) {
      unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
    }
  }
  return $out_file;
}

lib/Acme/Pinoko.pm  view on Meta::CPAN

package Acme::Pinoko;

use 5.008_008;
use strict;
use warnings;
use utf8;

use Carp   ();
use Encode ();
use Module::Load ();
use Data::Recursive::Encode ();
use Lingua::JA::Regular::Unicode ();
use Lingua::JA::Halfwidth::Katakana;

our $VERSION = '0.02';

lib/Acme/Pinoko.pm  view on Meta::CPAN


                push(@poses, $pos);
                push(@prons, $pron);
            }
        }
    }
    else # Text::KyTea
    {
        my $results = $self->{parser}->parse($$text_ref);

        $results = Data::Recursive::Encode->decode_utf8($results);

        for my $result (@{$results})
        {
            push(@surfaces, $result->{surface});
            push(@poses,    $result->{tags}[$KYTEA_POSTAG_NUM][0]{feature});
            push(@prons,    $result->{tags}[$KYTEA_PRONTAG_NUM][0]{feature});
        }
    }

    return (\@surfaces, \@poses, \@prons);

lib/Acme/Pinoko.pm  view on Meta::CPAN

    s/ど(?!よ)/ろ/g;
    s/だ(?!のよ|ゆ|が)/ら/g;

    $_;
}

1;

__END__

=encoding utf8

=head1 NAME

Acme::Pinoko - Acchonburike!

=for test_synopsis
my (%config);

=head1 SYNOPSIS

  use Acme::Pinoko;
  use utf8;

  my $pinoko = Acme::Pinoko->new(%config);
  print $pinoko->say('ピノコ18のレディなのよ');
  # -> ピノコ18のレレイなのよさ

=head1 DESCRIPTION

Acme::Pinoko converts standard Japanese text to Pinoko-ish Japanese text.

Pinoko is a Japanese manga character. She speaks with a lisp and

t/03_say_mecab.t  view on Meta::CPAN

use strict;
use warnings;
use utf8;
use Test::Requires qw/Text::MeCab/;
use Test::Base;
plan tests => 1 * blocks;

binmode Test::More->builder->$_ => ':utf8'
    for qw/output failure_output todo_output/;

use Acme::Pinoko;

my $pinoko = Acme::Pinoko->new(parser => 'Text::MeCab');

run
{
    my $block = shift;
    is($pinoko->say($block->input), $block->expected);

t/04_say_kytea.t  view on Meta::CPAN

use strict;
use warnings;
use utf8;
use Test::Requires qw/Text::KyTea/;
use Test::Base;
plan tests => 1 * blocks;

binmode Test::More->builder->$_ => ':utf8'
    for qw/output failure_output todo_output/;

use Acme::Pinoko;

my $pinoko = Acme::Pinoko->new(parser => 'Text::KyTea');

run
{
    my $block = shift;
    is($pinoko->say($block->input), $block->expected);



( run in 0.268 second using v1.01-cache-2.11-cpan-4d50c553e7e )