Acme-Lingua-ZH-Remix

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

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

    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.

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

    return ${ random(@{ $self->phrases->{$type}||=[] }) || \'' };
}

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



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