diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-30 12:11:18 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-30 12:11:18 +0100 |
commit | 69c9402d15216fce58494083f4b8a16c44ede31f (patch) | |
tree | 6bbf2a54c6557cef6520a0ae75e403b120ad5e96 /src/libstat/classifiers | |
parent | 0591ed1478b66a9bf1eac411094218069d9043e4 (diff) | |
download | rspamd-69c9402d15216fce58494083f4b8a16c44ede31f.tar.gz rspamd-69c9402d15216fce58494083f4b8a16c44ede31f.zip |
[Feature] Save bayes probability in memory pool var
Issue: #613
Diffstat (limited to 'src/libstat/classifiers')
-rw-r--r-- | src/libstat/classifiers/bayes.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index 867fe4dc6..4e30f191e 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -196,7 +196,7 @@ bayes_classify (struct rspamd_classifier * ctx, GPtrArray *tokens, struct rspamd_task *task) { - double final_prob, h, s; + double final_prob, h, s, *pprob; char *sumbuf; struct rspamd_statfile *st = NULL; struct bayes_task_closure cl; @@ -273,6 +273,9 @@ bayes_classify (struct rspamd_classifier * ctx, } } + pprob = rspamd_mempool_alloc (task->task_pool, sizeof (*pprob)); + rspamd_mempool_set_variable (task->task_pool, "bayes_prob", pprob, NULL); + if (cl.processed_tokens > 0 && fabs (final_prob - 0.5) > 0.05) { sumbuf = rspamd_mempool_alloc (task->task_pool, 32); |