mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-10-13 12:00:59 +02:00
bayes: fix check for already categorized articles
This commit is contained in:
parent
e0940bfc4f
commit
5df13f31ef
@ -263,13 +263,18 @@ class Af_Sort_Bayes extends Plugin {
|
|||||||
function hook_article_filter($article) {
|
function hook_article_filter($article) {
|
||||||
$owner_uid = $article["owner_uid"];
|
$owner_uid = $article["owner_uid"];
|
||||||
|
|
||||||
|
// guid already includes owner_uid so we don't need to include it
|
||||||
|
$result = $this->dbh->query("SELECT id FROM {$this->sql_prefix}_references WHERE
|
||||||
|
document_id = '" . $this->dbh->escape_string($article['guid_hashed']) . "'");
|
||||||
|
|
||||||
|
if (db_num_rows($result) != 0) {
|
||||||
|
_debug("bayes: article already categorized");
|
||||||
|
return $article;
|
||||||
|
}
|
||||||
|
|
||||||
$nbs = new NaiveBayesianStorage($owner_uid);
|
$nbs = new NaiveBayesianStorage($owner_uid);
|
||||||
$nb = new NaiveBayesianNgram($nbs, 3);
|
$nb = new NaiveBayesianNgram($nbs, 3);
|
||||||
|
|
||||||
$ref = $nbs->getReference($article["guid"], false);
|
|
||||||
|
|
||||||
if (isset($ref["category_id"])) return $article; // already categorized
|
|
||||||
|
|
||||||
$categories = $nbs->getCategories();
|
$categories = $nbs->getCategories();
|
||||||
|
|
||||||
if (count($categories) > 0) {
|
if (count($categories) > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user