NAME

Acme::Lingua::ZH::Remix - The Chinese sentence generator.

SYNOPSIS

use Acme::Lingua::ZH::Remix;

my $x = Acme::Lingua::ZH::Remix->new;

# Generate a random sentance
say $x->random_sentence;

DESCRIPTION

Because lipsum is not funny enough, that is the reason to write this module.

This module is a Moose based OO module. You create an instance of it with new method, and then invoke methods on the returned object.

The random_sentence method returns a string of one sentence of Chinese like:

真是完全失敗,孩子!怎麼不動了呢?

It uses the corpus data from Project Gutenberg by default. All generate sentences are remixes of the corpus.

You can feed you own corpus data to the `feed` method:

my $x = Acme::Lingua::ZH::Remix->new;
$x->feed($my_corpus);

# Say something based on $my_corpus
say $x->random_santence;

The corpus should use full-width punctuation characters.

METHODS

split_corpus($corpus_text)

Takes a scalar, returns an list.

This is an utility method that does not change the internal state of the topic object.

feed($corpus_text)

Instance method. Takes a scalar, return the topic object.

Merge $corpus_text into the internal phrases corpus of the object.

random_sentence

Instance method. Takes no arguments, returns a scalar.

The returned scalar is the generate sentence.

COPYRIGHT

Copyright 2010 by Kang-min Liu, <gugod@gugod.org>

This program is free software; you can redistribute it a nd/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html