From: <jgr...@us...> - 2003-04-20 21:09:11
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1:/tmp/cvs-serv27489/Classifier Modified Files: Bayes.pm Log Message: Added a new API called get_magnet_types to get the possible header magnets so that the knowledge about them is controlled by the Bayes module in one place; added Cc magnets Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** Bayes.pm 20 Apr 2003 21:00:05 -0000 1.130 --- Bayes.pm 20 Apr 2003 21:09:06 -0000 1.131 *************** *** 260,266 **** if ( $self->{full_total__} > 0 ) { ! # ln(10) =~ 2.30258509299404568401799145468436 ! $self->{not_likely__} = -log( $self->{full_total__} ) - 2.30258509299404568401799145468436; --- 260,266 ---- if ( $self->{full_total__} > 0 ) { ! # ln(10) =~ 2.30258509299404568401799145468436 ! $self->{not_likely__} = -log( $self->{full_total__} ) - 2.30258509299404568401799145468436; *************** *** 718,722 **** # If no bucket has a probability better than 0.5, call the message "unclassified". my $class = 'unclassified'; ! if ( ( $total != 0 ) && ( $score{$ranking[0]} > $self->{unclassified__} + log($total) ) ) { $class = $ranking[0]; --- 718,722 ---- # If no bucket has a probability better than 0.5, call the message "unclassified". my $class = 'unclassified'; ! if ( ( $total != 0 ) && ( $score{$ranking[0]} > $self->{unclassified__} + log($total) ) ) { $class = $ranking[0]; *************** *** 806,811 **** # Kill header lines containing only whitespace (Exim does this) ! next if ( $line =~ /^[ \t]+(\r\n|\r|\n)$/i ); ! if ( !( $line =~ /^(\r\n|\r|\n)$/i ) ) { $message_size += length $line; --- 806,811 ---- # Kill header lines containing only whitespace (Exim does this) ! next if ( $line =~ /^[ \t]+(\r\n|\r|\n)$/i ); ! if ( !( $line =~ /^(\r\n|\r|\n)$/i ) ) { $message_size += length $line; *************** *** 1437,1440 **** --- 1437,1456 ---- $self->{magnets__}{$bucket}{$type}{$text} = 1; $self->save_magnets__(); + } + + # --------------------------------------------------------------------------------------------- + # + # get_magnet_types + # + # Get a hash mapping magnet types (e.g. from) to magnet names (e.g. From); + # + # --------------------------------------------------------------------------------------------- + + sub get_magnet_types + { + return ( 'from' => 'From', + 'to' => 'To', + 'subject' => 'Subject', + 'cc' => 'Cc' ); } |