]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php
cee2bb1d7bfeeb4b734be7a883260e63ae3e586a
3 class NaiveBayesianNgram
extends NaiveBayesian
{
7 * add Parameter for ngram
9 * @param NaiveBayesianStorage $nbs
13 function __construct($nbs, $n = 2) {
14 parent
::__construct($nbs);
22 * override method for ngram
24 * @param string $string
27 function _getTokens($string) {
30 if (mb_strlen($string)) {
31 for ($i = 0; $i < mb_strlen($string) - $this->N
; $i++
) {
32 $wd = mb_substr($string, $i, $this->N
);
34 if (mb_strlen($wd) == $this->N
) {
35 if (!array_key_exists($wd, $tokens)) {
46 $tokens = array_filter($tokens);