RE: [Spambayes] big imapfilter.py problem
What's happening here is in:
File "spambayes/message.py", line 118, in _getState (msg.c, msg.t) = self.db[msg.getId()]
self.db[msg.getID()]
is a email.Message object [...]
TimS might have a better idea, but I *think* that this is a result of the message db being fixed ;) The db used to store message objects, and now stores a tuple of the classification and training information. So self.db[msg.getID()] should return a tuple, *not* an email object. Delete (or rename) your message database and this should work. (This won't effect your classification database, just the memory of which messages have been classified/trained, which was inaccurate anyway). Apologies for this - we should have realised that old (message) databases would become invalid and need to be removed and posted a message to that effect. =Tony Meyer
"Meyer, Tony" <T.A.Meyer@massey.ac.nz> writes:
What's happening here is in:
File "spambayes/message.py", line 118, in _getState (msg.c, msg.t) = self.db[msg.getId()]
self.db[msg.getID()]
is a email.Message object [...]
TimS might have a better idea, but I *think* that this is a result of the message db being fixed ;) The db used to store message objects, and now stores a tuple of the classification and training information. So self.db[msg.getID()] should return a tuple, *not* an email object.
Delete (or rename) your message database and this should work. (This won't effect your classification database, just the memory of which messages have been classified/trained, which was inaccurate anyway).
What's a message database, and where do I find it? OK, I presume spambayes.messageinfo.db is it.
Apologies for this - we should have realised that old (message) databases would become invalid and need to be removed and posted a message to that effect.
No problem; just let me know if I've got the details about how to get out of it right. -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams <dave@boost-consulting.com> writes:
"Meyer, Tony" <T.A.Meyer@massey.ac.nz> writes:
What's happening here is in:
File "spambayes/message.py", line 118, in _getState (msg.c, msg.t) = self.db[msg.getId()]
self.db[msg.getID()]
is a email.Message object [...]
TimS might have a better idea, but I *think* that this is a result of the message db being fixed ;) The db used to store message objects, and now stores a tuple of the classification and training information. So self.db[msg.getID()] should return a tuple, *not* an email object.
Delete (or rename) your message database and this should work. (This won't effect your classification database, just the memory of which messages have been classified/trained, which was inaccurate anyway).
What's a message database, and where do I find it? OK, I presume spambayes.messageinfo.db is it.
Apologies for this - we should have realised that old (message) databases would become invalid and need to be removed and posted a message to that effect.
No problem; just let me know if I've got the details about how to get out of it right.
Okay, training worked, but: %python imapfilter.py -c Traceback (most recent call last): File "imapfilter.py", line 661, in ? run() File "imapfilter.py", line 651, in run imap_filter.Filter() File "imapfilter.py", line 526, in Filter self.unsure_folder) File "imapfilter.py", line 451, in Filter evidence=True) File "./spambayes/classifier.py", line 217, in chi2_spamprob clues = self._getclues(wordstream) File "./spambayes/classifier.py", line 441, in _getclues prob = self.probability(record) File "./spambayes/classifier.py", line 301, in probability assert hamcount <= nham AssertionError % What's the problem now? -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams <dave@boost-consulting.com> writes:
Okay, training worked, but:
%python imapfilter.py -c Traceback (most recent call last): File "imapfilter.py", line 661, in ? run() File "imapfilter.py", line 651, in run imap_filter.Filter() File "imapfilter.py", line 526, in Filter self.unsure_folder) File "imapfilter.py", line 451, in Filter evidence=True) File "./spambayes/classifier.py", line 217, in chi2_spamprob clues = self._getclues(wordstream) File "./spambayes/classifier.py", line 441, in _getclues prob = self.probability(record) File "./spambayes/classifier.py", line 301, in probability assert hamcount <= nham AssertionError %
What's the problem now?
Furthermore: %python imapfilter.py -t -v -c Loading database hammie.db... Loading state from hammie.db database hammie.db is an existing database, with 454 spam and 1242 ham Done. Training Training ham folder HamBox 418 trained. Training spam folder SpamBox 418 trained. Persisting hammie.db state in database Training took 118.465536952 seconds, 836 messages were trained Classifying Traceback (most recent call last): File "imapfilter.py", line 661, in ? run() File "imapfilter.py", line 651, in run imap_filter.Filter() File "imapfilter.py", line 518, in Filter imap.SelectFolder(self.spam_folder) File "imapfilter.py", line 221, in SelectFolder if self.current_folder != folder: File "imapfilter.py", line 372, in __cmp__ return cmp(self.name, obj.name) AttributeError: 'str' object has no attribute 'name'% %rm *.db %python imapfilter.py -t -v -c Loading database hammie.db... Loading state from hammie.db database hammie.db is a new database Done. Training Training ham folder HamBox 1660 trained. Training spam folder SpamBox 454 trained. Persisting hammie.db state in database Training took 136.448132992 seconds, 2114 messages were trained Classifying Traceback (most recent call last): File "imapfilter.py", line 661, in ? run() File "imapfilter.py", line 651, in run imap_filter.Filter() File "imapfilter.py", line 518, in Filter imap.SelectFolder(self.spam_folder) File "imapfilter.py", line 221, in SelectFolder if self.current_folder != folder: File "imapfilter.py", line 372, in __cmp__ return cmp(self.name, obj.name) AttributeError: 'str' object has no attribute 'name' %python imapfilter.py -t -v -c -D bayes.db Loading database bayes.db... Loading state from bayes.db database bayes.db is a new database Done. Training Training ham folder HamBox Traceback (most recent call last): File "imapfilter.py", line 661, in ? run() File "imapfilter.py", line 647, in run imap_filter.Train() File "imapfilter.py", line 488, in Train num_ham_trained = folder.Train(self.classifier, False) File "imapfilter.py", line 433, in Train classifier.unlearn(msg.asTokens(), not isSpam) File "./spambayes/classifier.py", line 277, in unlearn self._remove_msg(wordstream, is_spam) File "./spambayes/classifier.py", line 408, in _remove_msg raise ValueError("spam count would go negative!") ValueError: spam count would go negative! % different-every-time-ly y'rs. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams -
Meyer, Tony