From: Vsevolod Stakhov Date: Sat, 30 Apr 2016 14:51:08 +0000 (+0100) Subject: [Feature] Add learn condition to the default configuration X-Git-Tag: 1.3.0~580 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07483bda3b8e29d99c4a70bca70fa1f08c0a574b;p=thirdparty%2Frspamd.git [Feature] Add learn condition to the default configuration --- diff --git a/conf/statistic.conf b/conf/statistic.conf index 697f1ccefb..e574d00271 100644 --- a/conf/statistic.conf +++ b/conf/statistic.conf @@ -20,27 +20,54 @@ # http://rspamd.com/rspamd_statistics/bayes.ham.sqlite classifier "bayes" { - tokenizer { - name = "osb"; - } - cache { - path = "${DBDIR}/learn_cache.sqlite"; - } - min_tokens = 11; - backend = "sqlite3"; - languages_enabled = true; - min_learns = 200; + tokenizer { + name = "osb"; + } + cache { + path = "${DBDIR}/learn_cache.sqlite"; + } + min_tokens = 11; + backend = "sqlite3"; + languages_enabled = true; + min_learns = 200; - statfile { - symbol = "BAYES_HAM"; - path = "${DBDIR}/bayes.ham.sqlite"; - spam = false; - } - statfile { - symbol = "BAYES_SPAM"; - path = "${DBDIR}/bayes.spam.sqlite"; - spam = true; - } + statfile { + symbol = "BAYES_HAM"; + path = "${DBDIR}/bayes.ham.sqlite"; + spam = false; + } + statfile { + symbol = "BAYES_SPAM"; + path = "${DBDIR}/bayes.spam.sqlite"; + spam = true; + } + learn_condition =<= 0.9 + else + cl = 'ham' + in_class = prob <= 0.1 + end + + if is_unlearn and (not in_class) then + return false,string.format('not in class %s; probability %.2f%%', + cl, math.abs((prob - 0.5) * 200.0)) + elseif (not is_unlearn) and in_class then + return false,string.format('already in class %s; probability %.2f%%', + cl, math.abs((prob - 0.5) * 200.0)) + end + end + + return true +end +EOD } .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/statistic.conf"