bogotune-0.2.7

Boris 'pi' Piwinger 3.14 at logic.univie.ac.at
Thu Jun 26 14:42:37 CEST 2003


Greg Louis wrote:

> Version 0.2.7 of bogotune, a perl script to find optimum parameters for
> bogofilter, is now available as
>   http://www.bgl/nu/bogofilter/bogotune-0.2.7.tgz

Somme errors in the script:

Line 109 can be simplified:
    ($scount, $ncount) = (split /\s+/, $counts)[1,2];
This removes a bogus variable.

Line 294 should read:
    my $i; my $ndots = POSIX::ceil(70 * $cur / $top);

Line 361 has $errr, I guess it should be $err.

Subroutine log10 redefined at bogotune line 309. Not really
a problem, but you know.

Patch fixing those attached.

pi
-------------- next part --------------
--- bogotune.old	Thu Jun 26 12:23:36 2003
+++ bogotune	Thu Jun 26 12:38:17 2003
@@ -106,7 +106,7 @@
 $err = 0;
 if(!$counts) { $err = 1; }
 else {
-    ($junk, $scount, $ncount) = split /\s+/, $counts;
+    ($scount, $ncount) = (split /\s+/, $counts)[1,2];
     if($scount < 2000 || $ncount < 2000) { $err = 2; }
     else {
 	$scalefactor = $scount / $ncount;
@@ -291,7 +291,7 @@
 
 sub progress {
     my ($cur, $top) = @_;
-    my $i, $ndots; $ndots = POSIX::ceil(70 * $cur / $top);
+    my $i; my $ndots = POSIX::ceil(70 * $cur / $top);
     if($ndots < 1) { $ndots = 1; }
     print("\r["); for $i (0 .. $ndots-1) { print("."); }
     for($i = $ndots; $i < 70; ++$i) { print(" "); }
@@ -306,7 +306,7 @@
     return($parms[$pi][5]);
 }
 
-sub log10 { my $n = shift; return log($n) / log(10); }
+sub my_log10 { my $n = shift; return log($n) / log(10); }
 
 @rsval = (10 ** 0, 10 ** -0.5, 10 ** -1, 10 ** -1.5, 10 ** -2);
 @mdval = (0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45);
@@ -358,7 +358,7 @@
 		    $err = system($cmd) >> 8;
 		    if($err > 2) {
 			print("Warning re processing spam messages: ",
-			    $errr, "\n");
+			    $err, "\n");
 		    }
 		    open(SCORES, $workfn) or
 			yuk(8, "Couldn't open spam scores");
@@ -448,8 +448,8 @@
 
     if($scantype == "coarse") {
 	@rsval = @mdval = ();
-	$s0 = log10($robs) - 0.5; $s0 = -2 if $s0 < -2;
-	$s1 = log10($robs) + 0.5; $s1 = 0 if $s1 > 0;
+	$s0 = my_log10($robs) - 0.5; $s0 = -2 if $s0 < -2;
+	$s1 = my_log10($robs) + 0.5; $s1 = 0 if $s1 > 0;
 	for($i=$s1; $i>=$s0; $i-=0.25) { push @rsval, 10 ** $i; }
 	$s0 = $md - 0.075; $s0 = 0.02 if $s0 < 0.02;
 	$s1 = $md + 0.075; $s1 = 0.465 if $s1 > 0.465;



More information about the bogofilter mailing list