1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 23:25:56 +00:00

classifier: add workaround for division by zero

This commit is contained in:
Andrew Dolgov
2015-06-17 19:26:50 +03:00
parent e0ae194ac9
commit 4da0cb323f

View File

@@ -80,7 +80,11 @@
$scores[$category] = $data['probability'];
// small probability for a word not in the category
// maybe putting 1.0 as a 'no effect' word can also be good
if ($data['word_count'] > 0)
$small_proba = 1.0 / ($data['word_count'] * 2);
else
$small_proba = 0;
reset($tokens);