[Spambayes-checkins] spambayes classifier.py,1.47,1.48
Jeremy Hylton
jhylton@users.sourceforge.net
Mon Nov 4 21:24:54 2002
Update of /cvsroot/spambayes/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv17508
Modified Files:
classifier.py
Log Message:
Two changes to support pspam.
Make Bayes a classic class so that it can be mixed with
ExtensionClass.
Define Bayes.WordInfoClass so that a subclass can define a different
class to represent word info.
Index: classifier.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/classifier.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** classifier.py 4 Nov 2002 21:06:26 -0000 1.47
--- classifier.py 4 Nov 2002 21:24:52 -0000 1.48
***************
*** 80,84 ****
self.spamprob) = t
! class Bayes(object):
# Defining __slots__ here made Jeremy's life needlessly difficult when
# trying to hook this all up to ZODB as a persistent object. There's
--- 80,84 ----
self.spamprob) = t
! class Bayes:
# Defining __slots__ here made Jeremy's life needlessly difficult when
# trying to hook this all up to ZODB as a persistent object. There's
***************
*** 92,95 ****
--- 92,98 ----
# )
+ # allow a subclass to use a different class for WordInfo
+ WordInfoClass = WordInfo
+
def __init__(self):
self.wordinfo = {}
***************
*** 401,405 ****
record = wordinfoget(word)
if record is None:
! record = WordInfo(now)
if is_spam:
--- 404,408 ----
record = wordinfoget(word)
if record is None:
! record = self.WordInfoClass(now)
if is_spam: