spambayes/scripts sb_server.py,1.42,1.43

"Tony Meyer" <[email protected]>
Newsgroups gmane.mail.spam.spambayes.cvs
Message-ID <[email protected]>
Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5703/scripts

Modified Files:
	sb_server.py 
Log Message:
Record session statistics correctly.

Index: sb_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_server.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** sb_server.py	9 Mar 2005 01:58:09 -0000	1.42
--- sb_server.py	6 Apr 2005 02:49:23 -0000	1.43
***************
*** 570,579 ****
                   len(args) == 2 and args[1] == '99999999')):
                  cls = msg.GetClassification()
!                 if cls == options["Headers", "header_ham_string"]:
!                     state.numHams += 1
!                 elif cls == options["Headers", "header_spam_string"]:
!                     state.numSpams += 1
!                 else:
!                     state.numUnsure += 1
  
                  # Suppress caching of "Precedence: bulk" or
--- 570,574 ----
                   len(args) == 2 and args[1] == '99999999')):
                  cls = msg.GetClassification()
!                 state.RecordClassification(cls, prob)
  
                  # Suppress caching of "Precedence: bulk" or
***************
*** 931,934 ****
--- 926,945 ----
          return messageName
  
+     def RecordClassification(self, cls, score):
+         """Record the classification in the session statistics.
+ 
+         cls should match one of the options["Headers", "header_*_string"]
+         values.
+ 
+         score is the score the message received.        
+         """
+         if cls == options["Headers", "header_ham_string"]:
+             self.numHams += 1
+         elif cls == options["Headers", "header_spam_string"]:
+             self.numSpams += 1
+         else:
+             self.numUnsure += 1
+         self.stats.RecordClassification(score)
+ 
  
  # Option-parsing helper functions
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.