Tony Meyer wrote:
>> I am looking for example usage of sb_xmlrpcsrv.py.
> 
> 
> I presume you mean sb_xmlrpcserver.py.

yes - the FAQ spells it to sb_xmlrpcsrv.py, see
http://spambayes.sourceforge.net/faq.html

> 
>> Is there any sample
>> code available to train a given mail as ham/spam?
> 
> 
> Have you looked at sb_client.py?  It classifies rather than trains,  but
> it's not particularly different.

Thanks for that hint. Now digged deeper into sb_xmlrpcserver.py and I
see, that the hammie.Hammie.train() method is not available. I think
a patch like this is needed:

--- sb_xmlrpcserver.py,orig     2006-03-14 10:20:15.000000000 +0100
+++ sb_xmlrpcserver.py  2006-03-14 10:44:34.629148074 +0100
@@ -60,6 +60,16 @@
             pass
         return xmlrpclib.Binary(hammie.Hammie.filter(self, msg, *extra))

+    def train(self, msg, is_spam):
+        try:
+            msg = msg.data
+        except AttributeError:
+            pass
+        hammie.Hammie.train(self, msg, is_spam)
+
+       # how do I return "nothing"? (in C this would be a void function)
+       return xmlrpclib.Boolean(True)
+

 def usage(code, msg=''):
     """Print usage message and sys.exit(code)."""


A minor issue is, that I dont know, how I could return nothing (None?)
from that xmlrpc call - so I return a boolean True.

Would such a patch be accepted?

Do I miss anything?

> 
> =Tony.Meyer
> 

        thanks Tony
        joerg

_______________________________________________
[email protected]
http://mail.python.org/mailman/listinfo/spambayes
Check the FAQ before asking: http://spambayes.sf.net/faq.html

Reply via email to