[Spambayes-checkins] spambayes/scripts sb_mboxtrain.py,1.2,1.3
Skip Montanaro
montanaro at users.sourceforge.net
Thu Sep 18 11:36:32 EDT 2003
Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv17627/scripts
Modified Files:
sb_mboxtrain.py
Log Message:
Minor performance boost when training on lots of mail. Only display every
tenth message number. More time is spent training and less time waiting
for i/o.
Index: sb_mboxtrain.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_mboxtrain.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sb_mboxtrain.py 9 Sep 2003 07:03:54 -0000 1.2
--- sb_mboxtrain.py 18 Sep 2003 15:36:30 -0000 1.3
***************
*** 107,112 ****
continue
counter += 1
! if loud:
! sys.stdout.write(" %s \r" % fn)
sys.stdout.flush()
f = file(cfn, "rb")
--- 107,112 ----
continue
counter += 1
! if loud and counter % 10 == 0:
! sys.stdout.write("\r%6d" % counter)
sys.stdout.flush()
f = file(cfn, "rb")
***************
*** 128,133 ****
if loud:
! print (" Trained %d out of %d messages " %
! (trained, counter))
def mbox_train(h, path, is_spam, force):
--- 128,134 ----
if loud:
! sys.stdout.write("\r%6d" % counter)
! sys.stdout.write("\r Trained %d out of %d messages\n" %
! (trained, counter))
def mbox_train(h, path, is_spam, force):
***************
*** 152,157 ****
for msg in mbox:
counter += 1
! if loud:
! sys.stdout.write(" %s\r" % counter)
sys.stdout.flush()
if msg_train(h, msg, is_spam, force):
--- 153,158 ----
for msg in mbox:
counter += 1
! if loud and counter % 10 == 0:
! sys.stdout.write("\r%6d" % counter)
sys.stdout.flush()
if msg_train(h, msg, is_spam, force):
***************
*** 181,186 ****
f.close()
if loud:
! print (" Trained %d out of %d messages " %
! (trained, counter))
def mhdir_train(h, path, is_spam, force):
--- 182,188 ----
f.close()
if loud:
! sys.stdout.write("\r%6d" % counter)
! sys.stdout.write("\r Trained %d out of %d messages\n" %
! (trained, counter))
def mhdir_train(h, path, is_spam, force):
***************
*** 199,204 ****
cfn = fn
tfn = os.path.join(path, "spambayes.tmp")
! if loud:
! sys.stdout.write(" %s \r" % fn)
sys.stdout.flush()
f = file(fn, "rb")
--- 201,206 ----
cfn = fn
tfn = os.path.join(path, "spambayes.tmp")
! if loud and counter % 10 == 0:
! sys.stdout.write("\r%6d" % counter)
sys.stdout.flush()
f = file(fn, "rb")
***************
*** 218,223 ****
if loud:
! print (" Trained %d out of %d messages " %
! (trained, counter))
def train(h, path, is_spam, force, trainnew, removetrained):
--- 220,226 ----
if loud:
! sys.stdout.write("\r%6d" % counter)
! sys.stdout.write("\r Trained %d out of %d messages\n" %
! (trained, counter))
def train(h, path, is_spam, force, trainnew, removetrained):
More information about the Spambayes-checkins
mailing list