[Spambayes-checkins] spambayes/pspam/pspam profile.py,1.5,1.6
Jeremy Hylton
jhylton@users.sourceforge.net
Tue Nov 26 17:16:37 2002
Update of /cvsroot/spambayes/spambayes/pspam/pspam
In directory sc8-pr-cvs1:/tmp/cvs-serv22659/pspam/pspam
Modified Files:
profile.py
Log Message:
Minimal and ultimately fruitless attempt to get this code uptodate.
Index: profile.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pspam/pspam/profile.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** profile.py 12 Nov 2002 07:03:20 -0000 1.5
--- profile.py 26 Nov 2002 17:16:35 -0000 1.6
***************
*** 44,56 ****
class WordInfo(Persistent):
! def __init__(self, atime, spamprob=options.unknown_word_prob):
! self.atime = atime
! self.spamcount = self.hamcount = self.killcount = 0
! self.spamprob = spamprob
def __repr__(self):
! return "WordInfo%r" % repr((self.atime, self.spamcount,
! self.hamcount, self.killcount,
! self.spamprob))
class PBayes(classifier.Bayes, Persistent):
--- 44,55 ----
class WordInfo(Persistent):
! def __init__(self):
! self.spamcount = self.hamcount = 0
def __repr__(self):
! return "WordInfo(%r, %r)" % (self.spamcount, self.hamcount)
!
! class PMetaInfo(classifier.MetaInfo, Persistent):
! pass
class PBayes(classifier.Bayes, Persistent):
***************
*** 61,64 ****
--- 60,64 ----
classifier.Bayes.__init__(self)
self.wordinfo = IterOOBTree()
+ self.meta = PMetaInfo()
# XXX what about the getstate and setstate defined in base class
***************
*** 88,93 ****
changed1 = self._update(self.hams, False)
changed2 = self._update(self.spams, True)
! if changed1 or changed2:
! self.classifier.update_probabilities()
get_transaction().commit()
log("updated probabilities")
--- 88,93 ----
changed1 = self._update(self.hams, False)
changed2 = self._update(self.spams, True)
! ## if changed1 or changed2:
! ## self.classifier.update_probabilities()
get_transaction().commit()
log("updated probabilities")
***************
*** 111,120 ****
# Otherwise some new entries will cause scoring to fail.
for msg in added.keys():
! self.classifier.learn(tokenize(msg), is_spam, False)
del added
get_transaction().commit(1)
log("learned")
for msg in removed.keys():
! self.classifier.unlearn(tokenize(msg), is_spam, False)
if removed:
log("unlearned")
--- 111,120 ----
# Otherwise some new entries will cause scoring to fail.
for msg in added.keys():
! self.classifier.learn(tokenize(msg), is_spam)
del added
get_transaction().commit(1)
log("learned")
for msg in removed.keys():
! self.classifier.unlearn(tokenize(msg), is_spam)
if removed:
log("unlearned")
More information about the Spambayes-checkins
mailing list