[Spambayes-checkins] spambayes/contrib tte.py,1.1,1.2

Skip Montanaro montanaro at users.sourceforge.net
Thu Feb 12 17:03:29 EST 2004


Update of /cvsroot/spambayes/spambayes/contrib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20763

Modified Files:
	tte.py 
Log Message:
record time (in seconds) to execute each round and count the number of
leftover hams and spams at the end


Index: tte.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/contrib/tte.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tte.py	6 Feb 2004 21:58:15 -0000	1.1
--- tte.py	12 Feb 2004 22:03:27 -0000	1.2
***************
*** 24,30 ****
--- 24,33 ----
  """
  
+ from __future__ import division
+ 
  import sys
  import getopt
  import os
+ import datetime
  
  from spambayes import storage
***************
*** 50,53 ****
--- 53,57 ----
          round += 1
          hmisses = smisses = nmsgs = 0
+         start = datetime.datetime.now()
          try:
              while not maxmsgs or nmsgs < maxmsgs:
***************
*** 69,75 ****
          except StopIteration:
              pass
!         
!         print "\rround: %2d, msgs: %4d, ham misses: %3d, spam misses: %3d" % \
!               (round, nmsgs, hmisses, smisses)
  
  def main(args):
--- 73,98 ----
          except StopIteration:
              pass
!             
!         delta = datetime.datetime.now()-start
!         seconds = delta.seconds + delta.microseconds/1000000
! 
!         print "\rround: %2d, msgs: %4d, ham misses: %3d, spam misses: %3d, %.3fs" % \
!               (round, nmsgs, hmisses, smisses, seconds)
! 
!     nhamleft = 0
!     try:
!         while True:
!             hambone.next()
!             nhamleft += 1
!     except StopIteration:
!         if nhamleft: print nhamleft, "untrained hams"
! 
!     nspamleft = 0
!     try:
!         while True:
!             spamcan.next()
!             nspamleft += 1
!     except StopIteration:
!         if nspamleft: print nspamleft, "untrained spams"
  
  def main(args):




More information about the Spambayes-checkins mailing list