From: <jgr...@us...> - 2003-04-18 18:58:27
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1:/tmp/cvs-serv7209/Classifier Modified Files: Bayes.pm MailParse.pm Log Message: Completed the implementation of QuickMagnets, moved the viewing of a message to its own page (/view) Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** Bayes.pm 16 Apr 2003 23:52:28 -0000 1.127 --- Bayes.pm 18 Apr 2003 18:58:22 -0000 1.128 *************** *** 592,631 **** # less than 2 ** -54 is insignificant, and need not be computed. foreach my $b (@ranking) { $raw_score{$b} = $score{$b}; $score{$b} -= $base_score; ! ! # ln(2) =~ 0.693147180559945309417232121458177 ! ! $total += exp($score{$b}) if ($score{$b} > ( -54 * 0.693147180559945309417232121458177 ) ); } if ($self->{wordscores__} && defined($ui) ) { my @qm = @{$self->{parser__}->quickmagnets()}; ! my %language = $ui->language(); my $session_key = $ui->session_key(); if ( $#qm >= 0 ) { ! $self->{scores__} = "<p><b>$language{QuickMagnets}</b><p>\n<table class=\"top20Words\">\n<tr>\n<th scope=\"col\">$language{Magnet}</th>\n<th>$language{Magnet_Always}</th>\n"; ! ! foreach my $m (@qm) { ! $self->{scores__} .= "<tr><td scope=\"col\">$m</td><td>"; ! $self->{scores__} .= "<form action=\"/magnets\">\n"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"session\" value=\"$session_key\" />"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"type\" id=\"magnetsAddType\" />"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"text\" id=\"magnetsAddText\" />"; ! $self->{scores__} .= "<select name=\"bucket\" id=\"magnetsAddBucket\">\n<option value=\"\"></option>\n"; - my @buckets = $self->get_buckets(); foreach my $bucket (@buckets) { $self->{scores__} .= "<option value=\"$bucket\">$bucket</option>\n"; } ! $self->{scores__} .= "</select><input type=\"submit\" class=\"submit\" name=\"create\" value=\"$language{Create}\" /></form></td></tr>"; } ! $self->{scores__} .= "</table>"; } --- 592,635 ---- # less than 2 ** -54 is insignificant, and need not be computed. + my $ln2 = log(2); + foreach my $b (@ranking) { $raw_score{$b} = $score{$b}; $score{$b} -= $base_score; ! ! $total += exp($score{$b}) if ($score{$b} > ( -54 * $ln2 ) ); } if ($self->{wordscores__} && defined($ui) ) { my @qm = @{$self->{parser__}->quickmagnets()}; ! my %language = $ui->language(); my $session_key = $ui->session_key(); if ( $#qm >= 0 ) { ! my @buckets = $self->get_buckets(); ! my $i = 0; ! $self->{scores__} .= "<form action=\"/magnets\" method=\"POST\">\n"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"session\" value=\"$session_key\" />"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"count\" value=\"" . ($#qm+1) . "\" />"; ! $self->{scores__} .= "<hr><b>$language{QuickMagnets}</b><p>\n<table class=\"top20Words\">\n<tr>\n<th scope=\"col\">$language{Magnet}</th>\n<th>$language{Magnet_Always}</th>\n"; ! while ( $#qm >= 0 ) { ! my $type = shift @qm; ! my $text = shift @qm; ! $i += 1; ! $self->{scores__} .= "<tr><td scope=\"col\">$type: $text</td><td>"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"type$i\" id=\"magnetsAddType\" value=\"$type\"/>"; ! $self->{scores__} .= "<input type=\"hidden\" name=\"text$i\" id=\"magnetsAddText\" value=\"$text\"/>"; ! $self->{scores__} .= "<select name=\"bucket$i\" id=\"magnetsAddBucket\">\n<option value=\"\"></option>\n"; foreach my $bucket (@buckets) { $self->{scores__} .= "<option value=\"$bucket\">$bucket</option>\n"; } ! $self->{scores__} .= "</select></td></tr>"; } ! $self->{scores__} .= "<tr><td></td><td><input type=\"submit\" class=\"submit\" name=\"create\" value=\"$language{Create}\" /></td></tr></table></form>"; } *************** *** 647,651 **** $self->{scores__} .= "</table><hr>"; ! $self->{scores__} .= "<table class=\"top20Words\">\n<tr><td colspan=\"4\"> </td></tr>\n"; $self->{scores__} .= "<tr>\n<th scope=\"col\">$language{Word}</th><th> </th><th scope=\"col\">$language{Count}</th><th> </th>\n"; --- 651,655 ---- $self->{scores__} .= "</table><hr>"; ! $self->{scores__} .= "<table class=\"top20Words\">\n"; $self->{scores__} .= "<tr>\n<th scope=\"col\">$language{Word}</th><th> </th><th scope=\"col\">$language{Count}</th><th> </th>\n"; Index: MailParse.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/MailParse.pm,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** MailParse.pm 12 Apr 2003 22:52:57 -0000 1.113 --- MailParse.pm 18 Apr 2003 18:58:23 -0000 1.114 *************** *** 181,185 **** if ( $prefix =~ /(from|to|cc|subject)/i ) { ! push @{$self->{quickmagnets__}}, ("$prefix: $word"); } --- 181,185 ---- if ( $prefix =~ /(from|to|cc|subject)/i ) { ! push @{$self->{quickmagnets__}}, ($prefix, $word); } |