Lingua::Gram - N-Gram Alrogithm for Unicode String
version 0.11.0
This module will use Perl's regular unicode expression to cut string, and calculate the N-Gram algorithm.
use Lingua::Gram; my $g = Lingua::Gram->new($string); my @unigramWords = $g->gram(1); # OR my @unigramWords = $g->unigram; my @bigramWords = $g->gram(2); # OR my @bigramWords = $g->bigram;
my $g = Lingua::Gram->new($string);
Create an object that contains $string as paring string.
$string
$g->bigram;
Return a list which is generated by bigram algorithm. (Faster)
$g->gram($num);
Return a list which is generated by $num-gram algorithm.
$num
$g->unigram;
Return a list which is generated by unigram algorithm. (Faster)
Gea-Suan Lin, <gslin at gslin.org>
<gslin at gslin.org>
Copyright 2010, 2011 Gea-Suan Lin.
This software is released under 3-clause BSD license. See http://www.opensource.org/licenses/bsd-license.php for more information.
To install Lingua::Gram, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::Gram
CPAN shell
perl -MCPAN -e shell install Lingua::Gram
For more information on module installation, please visit the detailed CPAN module installation guide.