Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv14361/Classifier
Modified Files:
Bayes.pm
Log Message:
Make the characters in a subject modification configurable; allow numbers in bucket names
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.140
retrieving revision 1.141
diff -C2 -d -r1.140 -r1.141
*** Bayes.pm 27 Apr 2003 01:11:00 -0000 1.140
--- Bayes.pm 2 May 2003 17:45:37 -0000 1.141
***************
*** 116,119 ****
--- 116,123 ----
$self->config_( 'corpus', 'corpus' );
+ # The characters that appear before and after a subject modification
+ $self->config_( 'subject_mod_left', '[' );
+ $self->config_( 'subject_mod_right', ']' );
+
# Get the hostname for use in the X-POPFile-Link header
$self->{hostname__} = hostname;
***************
*** 780,784 ****
{
my ( $self, $mail, $client, $dcount, $mcount, $nosave, $class, $echo ) = @_;
!
$echo = 1 unless (defined $echo);
--- 784,788 ----
{
my ( $self, $mail, $client, $dcount, $mcount, $nosave, $class, $echo ) = @_;
!
$echo = 1 unless (defined $echo);
***************
*** 846,854 ****
$message_size += length $line;
print TEMP $fileline;
!
# If there is no echoing occuring, it doesn't matter what we do to these
!
! if ($echo) {
!
if ( $line =~ /^Subject:(.*)/i ) {
$msg_subject = $1;
--- 850,857 ----
$message_size += length $line;
print TEMP $fileline;
!
# If there is no echoing occuring, it doesn't matter what we do to these
!
! if ( $echo ) {
if ( $line =~ /^Subject:(.*)/i ) {
$msg_subject = $1;
***************
*** 856,860 ****
next;
}
!
# Strip out the X-Text-Classification header that is in an incoming message
if ( ( $line =~ /^X-Text-Classification:/i ) == 0 ) {
--- 859,863 ----
next;
}
!
# Strip out the X-Text-Classification header that is in an incoming message
if ( ( $line =~ /^X-Text-Classification:/i ) == 0 ) {
***************
*** 891,895 ****
--- 894,900 ----
# Do the text classification and update the counter for that bucket that we just downloaded
# an email of that type
+
$classification = ($class ne '')?$class:$self->classify_file($temp_file);
+ my $modification = $self->config_( 'subject_mod_left' ) . $classification . $self->config_( 'subject_mod_right' );
# Add the Subject line modification or the original line back again
***************
*** 900,904 ****
( $self->{parameters__}{$classification}{subject} == 1 ) &&
( $self->{parameters__}{$classification}{quarantine} == 0 ) ) {
! $msg_subject = " [$classification]$msg_subject";
}
}
--- 905,909 ----
( $self->{parameters__}{$classification}{subject} == 1 ) &&
( $self->{parameters__}{$classification}{quarantine} == 0 ) ) {
! $msg_subject = " $modification$msg_subject";
}
}
***************
*** 947,951 ****
if ( !( $msg_subject =~ /\[\Q$classification\E\]/ ) &&
( $self->{parameters__}{$classification}{subject} == 1 ) ) {
! $msg_subject = " [$classification]$msg_subject";
}
}
--- 952,956 ----
if ( !( $msg_subject =~ /\[\Q$classification\E\]/ ) &&
( $self->{parameters__}{$classification}{subject} == 1 ) ) {
! $msg_subject = " $modification$msg_subject";
}
}
|