[Spambayes-checkins] spambayes hammie.py,1.6,1.7
Guido van Rossum
gvanrossum@users.sourceforge.net
Fri, 06 Sep 2002 21:23:18 -0700
Update of /cvsroot/spambayes/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv5312
Modified Files:
hammie.py
Log Message:
Sort the clues before formatting. I definitely like this better.
Index: hammie.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/hammie.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** hammie.py 7 Sep 2002 04:20:43 -0000 1.6
--- hammie.py 7 Sep 2002 04:23:15 -0000 1.7
***************
*** 221,226 ****
def formatclues(clues, sep="; "):
"""Format the clues into something readable."""
! # XXX Maybe sort by prob first?
! return sep.join(["%r: %.2f" % (word, prob) for word, prob in clues])
def filter(bayes, input, output):
--- 221,227 ----
def formatclues(clues, sep="; "):
"""Format the clues into something readable."""
! lst = [(prob, word) for word, prob in clues]
! lst.sort()
! return sep.join(["%r: %.2f" % (word, prob) for prob, word in lst])
def filter(bayes, input, output):