Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv23038/Classifier
Modified Files:
Bayes.pm MailParse.pm
Log Message:
Viewing of colorized messages is working again; new get_html_colored_message API in Classifier::Bayes
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.110
retrieving revision 1.111
diff -C2 -d -r1.110 -r1.111
*** Bayes.pm 3 Mar 2003 23:14:37 -0000 1.110
--- Bayes.pm 4 Mar 2003 21:25:16 -0000 1.111
***************
*** 187,191 ****
# ---------------------------------------------------------------------------------------------
#
! # get_color_
#
# Retrieves the color for a specific word, color is the most likely bucket
--- 187,191 ----
# ---------------------------------------------------------------------------------------------
#
! # get_color
#
# Retrieves the color for a specific word, color is the most likely bucket
***************
*** 194,198 ****
#
# ---------------------------------------------------------------------------------------------
! sub get_color_
{
my ($self, $word) = @_;
--- 194,198 ----
#
# ---------------------------------------------------------------------------------------------
! sub get_color
{
my ($self, $word) = @_;
***************
*** 650,654 ****
$wordstr = "$1...";
}
! my $wordcolor = get_color_($self, $word);
my $wordprobstr = sprintf("%12.4f", $wordprob{$word} / $wtprob{$word});
my $otherprobstr = sprintf("%12.4f", $wbprob{$word}{$ranking[0]} / $wtprob{$word});
--- 650,654 ----
$wordstr = "$1...";
}
! my $wordcolor = get_color($self, $word);
my $wordprobstr = sprintf("%12.4f", $wordprob{$word} / $wtprob{$word});
my $otherprobstr = sprintf("%12.4f", $wbprob{$word}{$ranking[0]} / $wtprob{$word});
***************
*** 1031,1034 ****
--- 1031,1057 ----
$self->{parameters__}{$bucket}{$parameter} = $value;
+ }
+
+ # ---------------------------------------------------------------------------------------------
+ #
+ # get_html_colored_message
+ #
+ # Parser a mail message stored in a file and returns HTML representing the message
+ # with coloring of the words
+ #
+ # $file The file to parse
+ #
+ # ---------------------------------------------------------------------------------------------
+
+ sub get_html_colored_message
+ {
+ my ( $self, $file ) = @_;
+
+ $self->{parser__}->{color__} = 1;
+ $self->{parser__}->{bayes__} = bless $self;
+ my $result = $self->{parser__}->parse_stream($file);
+ $self->{parser__}->{color__} = 0;
+
+ return $result;
}
Index: MailParse.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/MailParse.pm,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** MailParse.pm 3 Mar 2003 15:21:39 -0000 1.92
--- MailParse.pm 4 Mar 2003 21:25:19 -0000 1.93
***************
*** 154,158 ****
if ( $self->{color__} ) {
! my $color = $self->{bayes}->get_color($mword);
if ( $encoded == 0 ) {
$after = '&' if ( $after eq '>' );
--- 154,158 ----
if ( $self->{color__} ) {
! my $color = $self->{bayes__}->get_color($mword);
if ( $encoded == 0 ) {
$after = '&' if ( $after eq '>' );
|