From: <jgr...@us...> - 2003-03-05 20:07:03
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv23796/UI Modified Files: HTML.pm Log Message: Added delete_bucket and rename_bucket APIs and hooked them up to the UI; ecount and mcount become global values Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** HTML.pm 4 Mar 2003 22:01:23 -0000 1.104 --- HTML.pm 5 Mar 2003 20:06:18 -0000 1.105 *************** *** 388,392 **** my @buckets = $self->{classifier__}->get_buckets(); my $bc = $#buckets + 1; ! $update_check .= "<img border=\"0\" alt=\"\" src=\"http://www.usethesource.com/cgi-bin/popfile_stats.pl?bc=$bc&mc=$self->config_( 'mcount' )&ec=$self->config_( 'ecount' )\" />\n"; } --- 388,392 ---- my @buckets = $self->{classifier__}->get_buckets(); my $bc = $#buckets + 1; ! $update_check .= "<img border=\"0\" alt=\"\" src=\"http://www.usethesource.com/cgi-bin/popfile_stats.pl?bc=$bc&mc=" . $self->global_config_( 'mcount' ) . "&ec=" . $self->global_config_( 'ecount' ) . "\" />\n"; } *************** *** 1581,1586 **** if ( defined($self->{form__}{reset_stats}) ) { ! $self->config_( 'mcount', 0 ); ! $self->config_( 'ecount', 0 ); for my $bucket ($self->{classifier__}->get_buckets()) { $self->{classifier__}->set_bucket_parameter( $bucket, 'count', 0 ); --- 1581,1586 ---- if ( defined($self->{form__}{reset_stats}) ) { ! $self->global_config_( 'mcount', 0 ); ! $self->global_config_( 'ecount', 0 ); for my $bucket ($self->{classifier__}->get_buckets()) { $self->{classifier__}->set_bucket_parameter( $bucket, 'count', 0 ); *************** *** 1631,1642 **** if ( ( defined($self->{form__}{delete}) ) && ( $self->{form__}{name} ne '' ) ) { $self->{form__}{name} = lc($self->{form__}{name}); ! unlink( $self->config_( 'corpus' ) . "/$self->{form__}{name}/table" ); ! unlink( $self->config_( 'corpus' ) . "/$self->{form__}{name}/params" ); ! unlink( $self->config_( 'corpus' ) . "/$self->{form__}{name}/magnets" ); ! unlink( $self->config_( 'corpus' ) . "/$self->{form__}{name}/color" ); ! rmdir( $self->config_( 'corpus' ) . "/$self->{form__}{name}" ); ! $deletemessage = "<blockquote><b>" . sprintf( $self->{language__}{Bucket_Error6}, $self->{form__}{name} ) . "</b></blockquote>"; - $self->{classifier__}->load_word_matrix(); } --- 1631,1636 ---- if ( ( defined($self->{form__}{delete}) ) && ( $self->{form__}{name} ne '' ) ) { $self->{form__}{name} = lc($self->{form__}{name}); ! $self->{classifier__}->delete_bucket( $self->{form__}{name} ); $deletemessage = "<blockquote><b>" . sprintf( $self->{language__}{Bucket_Error6}, $self->{form__}{name} ) . "</b></blockquote>"; } *************** *** 1647,1653 **** $self->{form__}{oname} = lc($self->{form__}{oname}); $self->{form__}{newname} = lc($self->{form__}{newname}); ! rename($self->config_( 'corpus' ) . "/$self->{form__}{oname}" , $self->config_( 'corpus' ) . "/$self->{form__}{newname}"); $rename_message = "<blockquote><b>" . sprintf( $self->{language__}{Bucket_Error5}, $self->{form__}{oname}, $self->{form__}{newname} ) . "</b></blockquote>"; - $self->{classifier__}->load_word_matrix(); } } --- 1641,1646 ---- $self->{form__}{oname} = lc($self->{form__}{oname}); $self->{form__}{newname} = lc($self->{form__}{newname}); ! $self->{classifier__}->rename_bucket( $self->{form__}{oname}, $self->{form__}{newname} ); $rename_message = "<blockquote><b>" . sprintf( $self->{language__}{Bucket_Error5}, $self->{form__}{oname}, $self->{form__}{newname} ) . "</b></blockquote>"; } } *************** *** 1754,1763 **** my $number = pretty_number( $self, $self->{classifier__}->get_word_count() ); ! my $pmcount = pretty_number( $self, $self->config_( 'mcount' ) ); ! my $pecount = pretty_number( $self, $self->config_( 'ecount' ) ); my $accuracy = $self->{language__}{Bucket_NotEnoughData}; my $percent = 0; if ( $self->config_( 'mcount' ) > 0 ) { ! $percent = int( 10000 * ( $self->config_( 'mcount' ) - $self->config_( 'ecount' ) ) / $self->config_( 'mcount' ) ) / 100; $accuracy = "$percent%"; } --- 1747,1756 ---- my $number = pretty_number( $self, $self->{classifier__}->get_word_count() ); ! my $pmcount = pretty_number( $self, $self->global_config_( 'mcount' ) ); ! my $pecount = pretty_number( $self, $self->global_config_( 'ecount' ) ); my $accuracy = $self->{language__}{Bucket_NotEnoughData}; my $percent = 0; if ( $self->config_( 'mcount' ) > 0 ) { ! $percent = int( 10000 * ( $self->global_config_( 'mcount' ) - $self->global_config_( 'ecount' ) ) / $self->global_config_( 'mcount' ) ) / 100; $accuracy = "$percent%"; } *************** *** 2439,2443 **** if ( !$reclassified ) { $self->{classifier__}->add_message_to_bucket( $self->global_config_( 'msgdir' ) . $mail_file, $newbucket ); ! # TODO $self->config_( 'ecount' ) += 1 if ( $newbucket ne $bucket ); $self->{logger}->debug( "Reclassifying $mail_file from $bucket to $newbucket" ); --- 2432,2436 ---- if ( !$reclassified ) { $self->{classifier__}->add_message_to_bucket( $self->global_config_( 'msgdir' ) . $mail_file, $newbucket ); ! $self->global_config_( 'ecount', $self->global_config_( 'ecount' ) + 1 ) if ( $newbucket ne $bucket ); $self->{logger}->debug( "Reclassifying $mail_file from $bucket to $newbucket" ); *************** *** 2493,2497 **** if ( $bucket ne $usedtobe ) { ! $self->config_( 'ecount', $self->config_( 'ecount' ) - 1 ) if ( $self->config_( 'ecount' ) > 0 ); # TODO $self->{classifier__}->{parameters}{$bucket}{count} -= 1; # TODO $self->{classifier__}->{parameters}{$usedtobe}{count} += 1; --- 2486,2490 ---- if ( $bucket ne $usedtobe ) { ! $self->global_config_( 'ecount', $self->global_config_( 'ecount' ) - 1 ) if ( $self->global_config_( 'ecount' ) > 0 ); # TODO $self->{classifier__}->{parameters}{$bucket}{count} -= 1; # TODO $self->{classifier__}->{parameters}{$usedtobe}{count} += 1; |