[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.5,1.6

Tim Peters tim_one@users.sourceforge.net
Sun, 20 Oct 2002 11:49:55 -0700


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory usw-pr-cvs1:/tmp/cvs-serv5122

Modified Files:
	addin.py 
Log Message:
ShowClues():  For diagnostic purposes, and especially under chi-combining,
two digits after the decimal point aren't enough.  Switched to %g formats.
Also arranged to line up the words and spamprobs in even columns.  I
tried using an HTML table for this, but there was way too much vertical
space, and I didn't feel like fiddling endlessly with that.  It's easier
and works better to keep it in a PRE section.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** addin.py	20 Oct 2002 16:10:22 -0000	1.5
--- addin.py	20 Oct 2002 18:49:53 -0000	1.6
***************
*** 136,141 ****
  
      new_msg = app.CreateItem(0)
!     body = "<h2>Calculated Probability: %.2f</h2><br>" % (prob,)
!     body += "<pre>" + hammie.formatclues(clues, "<br>") + "</pre>"
      new_msg.Subject = "Spam Clues: " + item.Subject
      # Stupid outlook always switches to RTF :( Work-around
--- 136,151 ----
  
      new_msg = app.CreateItem(0)
!     body = ["<h2>Calculated Probability: %g</h2><br>" % prob]
!     push = body.append
!     push("<PRE>\n")
!     words = ['%r' % word for word, prob in clues]
!     probs = ['%g' % prob for word, prob in clues]
!     max_word_len = max(map(len, words))
!     for word, prob in zip(words, probs):
!         push(word + ' ' * (max_word_len - len(word)))
!         push(' ' + prob + '\n')
!     push("</PRE>\n")
!     body = ''.join(body)
! 
      new_msg.Subject = "Spam Clues: " + item.Subject
      # Stupid outlook always switches to RTF :( Work-around