[Spambayes-checkins]
spambayes/Outlook2000 addin.py,1.12,1.13 classify.py,1.7,1.8
filter.py,1.8,1.9 manager.py,1.15,1.16
Tim Peters
tim_one@users.sourceforge.net
Wed, 23 Oct 2002 21:22:21 -0700
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory usw-pr-cvs1:/tmp/cvs-serv22299
Modified Files:
addin.py classify.py filter.py manager.py
Log Message:
Indirecting thru Hammie (somtimes, not others) wasn't buying us anything.
Gave BayesManager its own score() method.
Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** addin.py 21 Oct 2002 22:50:59 -0000 1.12
--- addin.py 24 Oct 2002 04:22:19 -0000 1.13
***************
*** 144,149 ****
mapi_message = mgr.mapi.GetMessage(item.EntryID)
stream = mgr.GetBayesStreamForMessage(mapi_message)
! hammie = mgr.MakeHammie()
! prob, clues = hammie.score(stream, evidence=True)
new_msg = app.CreateItem(0)
body = ["<h2>Spam Score: %g</h2><br>" % prob]
--- 144,148 ----
mapi_message = mgr.mapi.GetMessage(item.EntryID)
stream = mgr.GetBayesStreamForMessage(mapi_message)
! prob, clues = mgr.score(stream, evidence=True)
new_msg = app.CreateItem(0)
body = ["<h2>Spam Score: %g</h2><br>" % prob]
Index: classify.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/classify.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** classify.py 20 Oct 2002 23:51:04 -0000 1.7
--- classify.py 24 Oct 2002 04:22:19 -0000 1.8
***************
*** 10,14 ****
def classify_folder( f, mgr, config, progress):
- hammie = mgr.MakeHammie()
messages = f.Messages
pythoncom.CoInitialize() # We are called on a different thread.
--- 10,13 ----
***************
*** 24,28 ****
progress.tick()
stream = mgr.GetBayesStreamForMessage(message)
! prob = hammie.score(stream, evidence=False)
added_prop = False
try:
--- 23,27 ----
progress.tick()
stream = mgr.GetBayesStreamForMessage(message)
! prob = mgr.score(stream)
added_prop = False
try:
Index: filter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/filter.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** filter.py 20 Oct 2002 23:51:04 -0000 1.8
--- filter.py 24 Oct 2002 04:22:19 -0000 1.9
***************
*** 16,21 ****
return
! hammie = mgr.MakeHammie()
! prob = hammie.score(stream, evidence=False)
num_rules = 0
for rule in mgr.config.rules:
--- 16,20 ----
return
! prob = mgr.score(stream)
num_rules = 0
for rule in mgr.config.rules:
Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** manager.py 21 Oct 2002 18:55:30 -0000 1.15
--- manager.py 24 Oct 2002 04:22:19 -0000 1.16
***************
*** 28,32 ****
import classifier
! import hammie
# Suck in CDO type lib
--- 28,32 ----
import classifier
! from tokenizer import tokenize
# Suck in CDO type lib
***************
*** 132,138 ****
self.bayes_dirty = False
- def MakeHammie(self):
- return hammie.Hammie(self.bayes)
-
def LoadConfig(self):
try:
--- 132,135 ----
***************
*** 229,232 ****
--- 226,232 ----
yield message
message = messages.GetNext()
+
+ def score(self, msg, evidence=False):
+ return self.bayes.spamprob(tokenize(msg), evidence)
_mgr = None