Updated spam filter autolearn settings
This commit is contained in:
@@ -36,7 +36,6 @@ impl SpamFilterAnalyzeClassify for Server {
|
||||
match store.key_exists(addr.address.as_str()).await {
|
||||
Ok(true) => {
|
||||
ctx.result.add_tag("SPAM_TRAP");
|
||||
ctx.result.spam_trap = true;
|
||||
return true;
|
||||
}
|
||||
Ok(false) => (),
|
||||
|
||||
@@ -44,7 +44,7 @@ pub trait SpamFilterAnalyzeScore: Sync + Send {
|
||||
pub struct SpamFilterScore {
|
||||
pub results: Vec<bool>,
|
||||
pub headers: String,
|
||||
pub spam_trap: bool,
|
||||
pub train_spam: Option<bool>,
|
||||
pub score: f32,
|
||||
}
|
||||
|
||||
@@ -163,10 +163,24 @@ impl SpamFilterAnalyzeScore for Server {
|
||||
);
|
||||
}
|
||||
|
||||
// Autolearn
|
||||
let mut train_spam = None;
|
||||
let config = self.core.spam.classifier.as_ref().unwrap();
|
||||
if config.auto_learn_spam_score > 0.0 && final_score >= config.auto_learn_spam_score {
|
||||
if !ctx.result.has_tag("PROB_SPAM_HIGH") {
|
||||
train_spam = Some(true);
|
||||
}
|
||||
} else if config.auto_learn_ham_score < 0.0
|
||||
&& final_score <= config.auto_learn_ham_score
|
||||
&& !ctx.result.has_tag("PROB_HAM_HIGH")
|
||||
{
|
||||
train_spam = Some(false);
|
||||
}
|
||||
|
||||
SpamFilterAction::Allow(SpamFilterScore {
|
||||
results: user_results,
|
||||
headers,
|
||||
spam_trap: ctx.result.spam_trap,
|
||||
train_spam,
|
||||
score: final_score,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -106,7 +106,6 @@ pub struct SpamFilterResult {
|
||||
pub rbl_url_checks: usize,
|
||||
pub rbl_email_checks: usize,
|
||||
pub llm_result: Option<(String, String)>,
|
||||
pub spam_trap: bool,
|
||||
}
|
||||
|
||||
pub struct SpamFilterContext<'x> {
|
||||
|
||||
Reference in New Issue
Block a user