commit 14530e6: [Feature] Add junk_threshold for autolearn

Victor Nawothnig dminuoso+git at icloud.com
Sat Oct 23 18:42:04 UTC 2021


Author: Victor Nawothnig
Date: 2021-10-15 02:06:16 +0200
URL: https://github.com/rspamd/rspamd/commit/14530e6a7c37eecc7c2441000006b423368b171f (refs/pull/3936/head)

[Feature] Add junk_threshold for autolearn

---
 conf/statistic.conf        | 5 +++--
 lualib/lua_bayes_learn.lua | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/conf/statistic.conf b/conf/statistic.conf
index 60b6dcb3e..5fea48320 100644
--- a/conf/statistic.conf
+++ b/conf/statistic.conf
@@ -44,8 +44,9 @@ classifier "bayes" {
 
   # Autolearn sample
   # autolearn {
-  #  spam_threshold = 6.0; # When to learn spam (score >= threshold)
-  #  ham_threshold = -0.5; # When to learn ham (score <= threshold)
+  #  spam_threshold = 6.0; # When to learn spam (score >= threshold and action is reject)
+  #  junk_threshold = 4.0; # When to learn spam (score >= threshold and action is rewrite subject or add header, and has two or more positive results)
+  #  ham_threshold = -0.5; # When to learn ham (score <= threshold and action is no action, and score is negative or has three or more negative results)
   #  check_balance = true; # Check spam and ham balance
   #  min_balance = 0.9; # Keep diff for spam/ham learns for at least this value
   #}
diff --git a/lualib/lua_bayes_learn.lua b/lualib/lua_bayes_learn.lua
index ae8d901f8..a059c6374 100644
--- a/lualib/lua_bayes_learn.lua
+++ b/lualib/lua_bayes_learn.lua
@@ -92,6 +92,11 @@ exports.autolearn = function(task, conf)
         log_can_autolearn(verdict, score, conf.spam_threshold)
         learn_spam = true
       end
+    elseif verdict == 'junk' then
+      if conf.junk_threshold and score >= conf.junk_threshold then
+        log_can_autolearn(verdict, score, conf.junk_threshold)
+        learn_spam = true
+      end
     elseif verdict == 'ham' then
       if conf.ham_threshold and score <= conf.ham_threshold then
         log_can_autolearn(verdict, score, conf.ham_threshold)


More information about the Commits mailing list