diff options
-rw-r--r-- | ymir.nix | 43 |
1 files changed, 3 insertions, 40 deletions
@@ -1118,22 +1118,9 @@ in rec { | |||
1118 | expire = 8640000; | 1118 | expire = 8640000; |
1119 | new_schema = true; | 1119 | new_schema = true; |
1120 | backend = "redis"; | 1120 | backend = "redis"; |
1121 | autolearn = true; | 1121 | per_user = true; |
1122 | 1122 | ||
1123 | per_user = <<EOD | 1123 | autolearn = [-5, 15]; |
1124 | return function(task) | ||
1125 | local rcpt = task:get_recipients(1) | ||
1126 | |||
1127 | if rcpt then | ||
1128 | one_rcpt = rcpt[1] | ||
1129 | if one_rcpt['domain'] then | ||
1130 | return one_rcpt['domain'] | ||
1131 | end | ||
1132 | end | ||
1133 | |||
1134 | return nil | ||
1135 | end | ||
1136 | EOD | ||
1137 | 1124 | ||
1138 | statfile { | 1125 | statfile { |
1139 | symbol = "BAYES_HAM"; | 1126 | symbol = "BAYES_HAM"; |
@@ -1143,30 +1130,6 @@ in rec { | |||
1143 | symbol = "BAYES_SPAM"; | 1130 | symbol = "BAYES_SPAM"; |
1144 | spam = true; | 1131 | spam = true; |
1145 | } | 1132 | } |
1146 | learn_condition =<<EOD | ||
1147 | return function(task, is_spam, is_unlearn) | ||
1148 | local prob = task:get_mempool():get_variable('bayes_prob', 'double') | ||
1149 | |||
1150 | if prob then | ||
1151 | local in_class = false | ||
1152 | local cl | ||
1153 | if is_spam then | ||
1154 | cl = 'spam' | ||
1155 | in_class = prob >= 0.95 | ||
1156 | else | ||
1157 | cl = 'ham' | ||
1158 | in_class = prob <= 0.05 | ||
1159 | end | ||
1160 | |||
1161 | if in_class then | ||
1162 | return false,string.format('already in class %s; probability %.2f%%', | ||
1163 | cl, math.abs((prob - 0.5) * 200.0)) | ||
1164 | end | ||
1165 | end | ||
1166 | |||
1167 | return true | ||
1168 | end | ||
1169 | EOD | ||
1170 | ''; | 1133 | ''; |
1171 | }; | 1134 | }; |
1172 | }; | 1135 | }; |