Changeset 130
- Timestamp:
- 27.05.2007 14:11:29 (1 year ago)
- Files:
-
- trunk/devel/FuzzyOcr.pm (modified) (4 diffs)
- trunk/devel/FuzzyOcr/Misc.pm (modified) (2 diffs)
- trunk/devel/FuzzyOcr/Scoring.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/devel/FuzzyOcr.pm
r128 r130 8 8 use strict; 9 9 use warnings; 10 use POSIX; 11 use Fcntl ':flock'; 10 12 use Mail::SpamAssassin; 11 13 use Mail::SpamAssassin::Logger; … … 17 19 use String::Approx 'adistr'; 18 20 use FileHandle; 19 use Fcntl ':flock';20 use POSIX;21 21 22 22 use lib qw(/etc/mail/spamassassin); # Allow placing of FuzzyOcr in siteconfigdir … … 902 902 } else { 903 903 my $score = '0.000'; 904 my $debuginfo = ( 905 "Words found:\n" 906 . join( "\n", @found ) 907 . "\n($cnt word occurrences found)" ); 904 my $debuginfo = ("Words found:\n".join( "\n", @found )."\n($cnt word occurrences found)" ); 908 905 if ($cnt >= $conf->{focr_counts_required}) { 909 906 $score = sprintf "%0.3f", $conf->{focr_base_score} + … … 932 929 $pms->{conf}->{scoreset}->[$set]->{"FUZZY_OCR"} = $score; 933 930 } 934 $pms->_handle_hit( "FUZZY_OCR", $score, "BODY: ", 935 $pms->{conf}-> {descriptions}->{FUZZY_OCR}. "\n$debuginfo" );931 $pms->_handle_hit( "FUZZY_OCR", $score, "BODY: ", "BODY", 932 $pms->{conf}->get_description_for_rule("FUZZY_OCR") . "\n$debuginfo" ); 936 933 } 937 934 if ($imgerr == 0 and $conf->{focr_keep_bad_images}<2) { trunk/devel/FuzzyOcr/Misc.pm
r122 r130 9 9 use FuzzyOcr::Logging qw(debuglog errorlog warnlog infolog); 10 10 use Time::HiRes qw( gettimeofday tv_interval ); 11 use POSIX qw(WIFEXITED WIFSIGNALED WIFSTOPPED WEXITSTATUS WTERMSIG WSTOPSIG 12 O_RDONLY O_WRONLY O_RDWR O_APPEND O_CREAT O_EXCL); 11 use POSIX qw(WIFEXITED WIFSIGNALED WIFSTOPPED WEXITSTATUS WTERMSIG WSTOPSIG); 13 12 14 13 # Provide some misc helper functions … … 71 70 my($flags) = 0; my($mode) = 0640; 72 71 $fname =~ s/^< *//; 73 $fname =~ s/^>> *// and $flags |= O_CREAT|O_WRONLY|O_APPEND;74 $fname =~ s/^> *// and $flags |= O_CREAT|O_WRONLY;72 $fname =~ s/^>> *// and $flags |= POSIX::O_CREAT|POSIX::O_WRONLY|POSIX::O_APPEND; 73 $fname =~ s/^> *// and $flags |= POSIX::O_CREAT|POSIX::O_WRONLY; 75 74 POSIX::close($fd_target); # ignore error, we may have just closed a log 76 75 my($fd_got) = POSIX::open($fname,$flags,$mode); trunk/devel/FuzzyOcr/Scoring.pm
r80 r130 27 27 } 28 28 $pms->_handle_hit( "FUZZY_OCR_WRONG_CTYPE", 29 $conf->{'focr_wrongctype_score'}, "BODY: ", 30 $pms->{conf}->{descriptions}->{FUZZY_OCR_WRONG_CTYPE}. "\n$debuginfo" );29 $conf->{'focr_wrongctype_score'}, "BODY: ", "BODY", 30 $pms->{conf}->get_description_for_rule("FUZZY_OCR_WRONG_CTYPE") . "\n$debuginfo" ); 31 31 } 32 32 } … … 48 48 } 49 49 $pms->_handle_hit( "FUZZY_OCR_WRONG_EXTENSION", 50 $conf->{'focr_wrongext_score'}, "BODY: ", 51 $pms->{conf}-> {descriptions}->{FUZZY_OCR_WRONG_EXTENSION}. "\n$debuginfo" );50 $conf->{'focr_wrongext_score'}, "BODY: ", "BODY", 51 $pms->{conf}->get_description_for_rule("FUZZY_OCR_WRONG_EXTENSION") . "\n$debuginfo" ); 52 52 } 53 53 } … … 68 68 $pms->{conf}->{scoreset}->[$set]->{"FUZZY_OCR_CORRUPT_IMG"} = $ws; 69 69 } 70 $pms->_handle_hit( "FUZZY_OCR_CORRUPT_IMG", $score, "BODY: ", 71 $pms->{conf}-> {descriptions}->{FUZZY_OCR_CORRUPT_IMG}. "\n$debuginfo" );70 $pms->_handle_hit( "FUZZY_OCR_CORRUPT_IMG", $score, "BODY: ", "BODY", 71 $pms->{conf}->get_description_for_rule("FUZZY_OCR_CORRUPT_IMG") . "\n$debuginfo" ); 72 72 } 73 73 } … … 82 82 $pms->{conf}->{scoreset}->[$set]->{"FUZZY_OCR_KNOWN_HASH"} = $ws; 83 83 } 84 $pms->_handle_hit( "FUZZY_OCR_KNOWN_HASH", $score, "BODY: ", 85 $pms->{conf}-> {descriptions}->{FUZZY_OCR_KNOWN_HASH}. $dinfo );84 $pms->_handle_hit( "FUZZY_OCR_KNOWN_HASH", $score, "BODY: ", "BODY", 85 $pms->{conf}->get_description_for_rule("FUZZY_OCR_KNOWN_HASH") . $dinfo ); 86 86 } 87 87
