Subject: | 3-gram bug |
Date: | Wed, 1 Aug 2018 15:33:15 -0300 |
To: | bug-Text-NGrammer [...] rt.cpan.org |
From: | Diego De Lima <diegodelima.poa [...] gmail.com> |
Bug on 3-gram generations (bi-grams are OK).
LINE 42:
my @ngrams = ();
my $step = $k + 1;
for (my $i = 0; $i <= ($length - ($n+($k*($n-1)))); $i += 1) {
my @tokens = ();
push @tokens, $_[$i];
while (@tokens < $n) {
push @tokens, $_[$i + ($k+1)];
}
push @ngrams, \@tokens;
}
SHOULD BE:
my @ngrams = ();
my $step = $k + 1;
for (my $i = 0; $i <= ($length - ($n+($k*($n-1)))); $i += 1) {
my @tokens = ();
push @tokens, $_[$i];
my $pos = 0;
while (@tokens < $n) {
push @tokens, $_[$i + ($k+$pos+1)];
$pos++;
}
push @ngrams, \@tokens;
}
Best Regards,
Diego de Lima
Message body is not shown because it is too large.