diff options
author | Heiko Adams <[email protected]> | 2015-11-30 10:29:44 +0100 |
---|---|---|
committer | Heiko Adams <[email protected]> | 2015-11-30 10:29:44 +0100 |
commit | 05761788b7b5a8a7e6c14333669acd0793886223 (patch) | |
tree | 464ccc3d98900e5dcf1a437662056161fa1280a4 /plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php | |
parent | 635ecdb9fa039adb8a0e8ead045bfda023e72bc4 (diff) | |
parent | 6f5d9c6889b6376527d7598857ac8816cf7980ab (diff) |
Merge remote-tracking branch 'origin/master' into german-translation
Diffstat (limited to 'plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php')
-rw-r--r-- | plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php b/plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php deleted file mode 100644 index cee2bb1d7..000000000 --- a/plugins/af_sort_bayes/lib/class.naivebayesian_ngram.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - - class NaiveBayesianNgram extends NaiveBayesian { - var $N = 2; - - /** - * add Parameter for ngram - * - * @param NaiveBayesianStorage $nbs - * @param ngram's N $n - * @return boolean - */ - function __construct($nbs, $n = 2) { - parent::__construct($nbs); - - $this->N = $n; - - return true; - } - - /** - * override method for ngram - * - * @param string $string - * @return multiple - */ - function _getTokens($string) { - $tokens = array(); - - if (mb_strlen($string)) { - for ($i = 0; $i < mb_strlen($string) - $this->N; $i++) { - $wd = mb_substr($string, $i, $this->N); - - if (mb_strlen($wd) == $this->N) { - if (!array_key_exists($wd, $tokens)) { - $tokens[$wd] = 0; - } - - $tokens[$wd]++; - } - } - } - - if (count($tokens)) { - // remove empty value - $tokens = array_filter($tokens); - } - - return $tokens; - } - - } |