Acme::Lingua::ZH::Remix - The Chinese sentence generator.
use Acme::Lingua::ZH::Remix; my $x = Acme::Lingua::ZH::Remix->new; # Generate a random sentance say $x->random_sentence;
Because lipsum is not funny enough, that is the reason to write this module.
This module is a Moo-based, with
new method being the constructor.
random_sentence method returns a string of one sentence of Chinese like:
By default, it uses small corpus data from Project Gutenberg. The generated 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.
Takes a scalar, returns an list.
This is an utility method that does not change the internal state of the topic object.
Instance method. Takes a scalar, return the topic object.
$corpus_text into the internal phrases corpus of the object.
Instance method. Optionally takes "min" or "max" parameter as the constraint of sentence length (number of characters).
Both min and max values are required to be integers greater or equal to zero. The value of max should be greater then the value of min. If any of these values are invalidate, it is treated as if they are not passed.
The default values of min, max are 0 and 140, respectively.
The implementation random algorthm based, thus it needs indefinite time to generate the result. If it takes more then 1000 iterations, it aborts and return the results anyway, regardless the length constraint. This can happen when the lengths of phrases from corpus do no adds up to a value within the given range.
The returned scalar is the generate sentence string of wide characters. (Which makes Encode::is_utf8 return true.)
Kang-min Liu <firstname.lastname@example.org>
Copyright 2010- by Kang-min Liu, <email@example.com>
This program is free software; you can redistribute it a nd/or modify it under the same terms as Perl itself.