aboutsummaryrefslogtreecommitdiffstats
path: root/conf
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-16 17:16:25 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-16 17:16:25 +0000
commit84b57c53f4f6e9b3915d57b4a5c83570fea50dc3 (patch)
tree3133d60d190721253f3a9c23c7b023b140790630 /conf
parentb19f0f3f12343a6e84baa26e7af7fd223a4fa84c (diff)
downloadrspamd-84b57c53f4f6e9b3915d57b4a5c83570fea50dc3.tar.gz
rspamd-84b57c53f4f6e9b3915d57b4a5c83570fea50dc3.zip
[Minor] Allow to have bulk learn in the default config
Diffstat (limited to 'conf')
-rw-r--r--conf/statistic.conf32
1 files changed, 18 insertions, 14 deletions
diff --git a/conf/statistic.conf b/conf/statistic.conf
index 26e73c4d2..d9b9a1b72 100644
--- a/conf/statistic.conf
+++ b/conf/statistic.conf
@@ -43,22 +43,26 @@ classifier "bayes" {
}
learn_condition =<<EOD
return function(task, is_spam, is_unlearn)
- local prob = task:get_mempool():get_variable('bayes_prob', 'double')
+ local learn_type = task:get_request_header('Learn-Type')
- if prob then
- local in_class = false
- local cl
- if is_spam then
- cl = 'spam'
- in_class = prob >= 0.95
- else
- cl = 'ham'
- in_class = prob <= 0.05
- end
+ if not (learn_type and tostring(learn_type) == 'bulk') then
+ local prob = task:get_mempool():get_variable('bayes_prob', 'double')
+
+ if prob then
+ local in_class = false
+ local cl
+ if is_spam then
+ cl = 'spam'
+ in_class = prob >= 0.95
+ else
+ cl = 'ham'
+ in_class = prob <= 0.05
+ end
- if in_class then
- return false,string.format('already in class %s; probability %.2f%%',
- cl, math.abs((prob - 0.5) * 200.0))
+ if in_class then
+ return false,string.format('already in class %s; probability %.2f%%',
+ cl, math.abs((prob - 0.5) * 200.0))
+ end
end
end