dspam/spamassassin: adjust karma awards

dspam: be more conservative when learning from karma
sa: added an SA autolearn bonus
This commit is contained in:
Matt Simerson 2013-03-27 19:04:38 -04:00
parent 23332dc71b
commit 133cd29acc
2 changed files with 7 additions and 4 deletions

View File

@ -634,13 +634,13 @@ sub autolearn_karma {
my $karma = $self->connection->notes('karma'); my $karma = $self->connection->notes('karma');
return if ! defined $karma; return if ! defined $karma;
if ( $karma < -1 && $response->{result} eq 'Innocent' ) { if ( $karma < -2 && $response->{result} eq 'Innocent' ) {
$self->log(LOGINFO, "training bad karma ($karma) FN as spam"); $self->log(LOGINFO, "training bad karma ($karma) FN as spam");
$self->train_error_as_spam( $transaction ); $self->train_error_as_spam( $transaction );
return 1; return 1;
}; };
if ( $karma > 1 && $response->{result} eq 'Spam' ) { if ( $karma > 2 && $response->{result} eq 'Spam' ) {
$self->log(LOGINFO, "training good karma ($karma) FP as ham"); $self->log(LOGINFO, "training good karma ($karma) FP as ham");
$self->train_error_as_ham( $transaction ); $self->train_error_as_ham( $transaction );
return 1; return 1;

View File

@ -394,9 +394,12 @@ sub reject {
}; };
my $ham_or_spam = $sa_results->{is_spam} eq 'Yes' ? 'Spam' : 'Ham'; my $ham_or_spam = $sa_results->{is_spam} eq 'Yes' ? 'Spam' : 'Ham';
if ( $ham_or_spam eq 'Spam' ) {
$self->adjust_karma( -1 );
};
my $status = "$ham_or_spam, $score"; my $status = "$ham_or_spam, $score";
my $learn = ''; my $learn = '';
my $al = $sa_results->{autolearn}; my $al = $sa_results->{autolearn}; # subject to local SA learn scores
if ( $al ) { if ( $al ) {
$self->adjust_karma( 1 ) if $al eq 'ham'; $self->adjust_karma( 1 ) if $al eq 'ham';
$self->adjust_karma( -1 ) if $al eq 'spam'; $self->adjust_karma( -1 ) if $al eq 'spam';
@ -404,7 +407,7 @@ sub reject {
}; };
my $reject = $self->{_args}{reject} or do { my $reject = $self->{_args}{reject} or do {
$self->log(LOGERROR, "pass, reject disabled ($status, $learn)"); $self->log(LOGERROR, "error, reject disabled ($status, $learn)");
return DECLINED; return DECLINED;
}; };