[Spambayes] Small patch to spambayes
Sidnei da Silva
sidnei at x3ng.com
Thu May 15 19:21:39 EDT 2003
Howdy,
I just checked out spambayes from CVS, and had to make two small
modifications to get it to read my maildir for training.
Attached theres a patch. Thanks!
--
Sidnei da Silva (dreamcatcher) <sidnei at x3ng.com.br>
X3ng Web Technology <http://www.x3ng.com.br>
GNU/Linux user 257852
Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc
Please go away.
-------------- next part --------------
Index: mboxtrain.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/mboxtrain.py,v
retrieving revision 1.7
diff -u -r1.7 mboxtrain.py
--- mboxtrain.py 13 Apr 2003 22:24:24 -0000 1.7
+++ mboxtrain.py 15 May 2003 21:19:18 -0000
@@ -32,7 +32,7 @@
need to rebuild your database from scratch.
-q
quiet mode; no output
-
+
-n train mail residing in "new" directory, in addition to "cur" directory,
which is always trained
"""
@@ -96,6 +96,9 @@
trained = 0
for fn in os.listdir(path):
+ # Skip dirs
+ if os.path.isdir(fn):
+ continue
counter += 1
cfn = os.path.join(path, fn)
tfn = os.path.join(path, "tmp",
Index: spambayes/classifier.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/classifier.py,v
retrieving revision 1.4
diff -u -r1.4 classifier.py
--- spambayes/classifier.py 8 Feb 2003 17:18:37 -0000 1.4
+++ spambayes/classifier.py 15 May 2003 21:19:19 -0000
@@ -389,6 +389,8 @@
self.nham = int(self.nham) + 1 # account for string nham
for word in Set(wordstream):
+ if type(word) is type(u''):
+ word = word.encode('latin1')
record = self._wordinfoget(word)
if record is None:
record = self.WordInfoClass()
More information about the Spambayes
mailing list