Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv21492/Classifier
Modified Files:
Bayes.pm
Log Message:
Tests for Bayes API functions
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.171
retrieving revision 1.172
diff -C2 -d -r1.171 -r1.172
*** Bayes.pm 26 Jul 2003 14:59:46 -0000 1.171
--- Bayes.pm 27 Jul 2003 01:37:58 -0000 1.172
***************
*** 351,354 ****
--- 351,357 ----
foreach my $bucket (@buckets) {
+
+ next if ( lc($bucket) ne $bucket );
+
my $color = '';
***************
*** 413,420 ****
# Loads an individual bucket
#
# ---------------------------------------------------------------------------------------------
sub load_bucket_
{
! my ($self, $bucket) = @_;
$bucket =~ /([[:alpha:]0-9-_]+)$/;
--- 416,425 ----
# Loads an individual bucket
#
+ # $bucket The bucket name
+ #
# ---------------------------------------------------------------------------------------------
sub load_bucket_
{
! my ( $self, $bucket ) = @_;
$bucket =~ /([[:alpha:]0-9-_]+)$/;
***************
*** 941,949 ****
# write_line__
#
! # Writes a line to a file and parses it
#
# $file File handle for file to write line to
# $line The line to write
! # $class The current classification
#
# ---------------------------------------------------------------------------------------------
--- 946,954 ----
# write_line__
#
! # Writes a line to a file and parses it unless the classification is already known
#
# $file File handle for file to write line to
# $line The line to write
! # $class (optional) The current classification
#
# ---------------------------------------------------------------------------------------------
***************
*** 1315,1319 ****
my $value = $self->get_value_( $bucket, $word );
! return int( exp( $value ) * $self->get_bucket_word_count( $bucket ) + 0.5 );
}
--- 1320,1328 ----
my $value = $self->get_value_( $bucket, $word );
! if ( $value == 0 ) {
! return 0;
! } else {
! return int( exp( $value ) * $self->get_bucket_word_count( $bucket ) + 0.5 );
! }
}
***************
*** 1469,1473 ****
if ( !defined( $self->{total__}{$bucket} ) ) {
! return;
}
--- 1478,1482 ----
if ( !defined( $self->{total__}{$bucket} ) ) {
! return 0;
}
***************
*** 1481,1484 ****
--- 1490,1495 ----
$self->load_word_matrix_();
+
+ return 1;
}
***************
*** 1498,1502 ****
if ( !defined( $self->{total__}{$old_bucket} ) ) {
! return;
}
--- 1509,1513 ----
if ( !defined( $self->{total__}{$old_bucket} ) ) {
! return 0;
}
***************
*** 1504,1507 ****
--- 1515,1520 ----
$self->load_word_matrix_();
+
+ return 1;
}
|