Acme-Lingua-ZH-Remix

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- use AnyMoose instead

0.90
	- Make it a Moose-based module. Deprecate all old usages.

0.14
	- Add c9s as corpus author
	- small rewrite of the generating algorithm.

0.13
	- The default corpus is changed to the texts from a Taiwan writer.

0.12
	- Improve init_phrase to extract text from be project gutenberg better

0.11
	- Use a public domain corpus by default

0.10
	- First release

README  view on Meta::CPAN

    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.

    The "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;

README  view on Meta::CPAN

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

  random_sentence( min => $min, max => $max )
    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.)

lib/Acme/Lingua/ZH/Remix.pm  view on Meta::CPAN

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

This module is a L<Moo>-based, with C<new> method being the constructor.

The C<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;

lib/Acme/Lingua/ZH/Remix.pm  view on Meta::CPAN


=head2 random_sentence( min => $min, max => $max )

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

=cut



( run in 0.436 second using v1.01-cache-2.11-cpan-0a6323c29d9 )