Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7990

Modified Files:
      Tag: CORESVR
        XMLRPCPlugin.py 
Log Message:
Dump the training-related methods.  I think the core server will manage
training.



Index: XMLRPCPlugin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Attic/XMLRPCPlugin.py,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** XMLRPCPlugin.py     5 Jun 2007 02:18:13 -0000       1.1.2.5
--- XMLRPCPlugin.py     5 Jun 2007 02:43:41 -0000       1.1.2.6
***************
*** 29,48 ****
          The return value is as for the score method.
  
-     train(form_dict, extra_tokens, is_spam) -> ''
-         Trains the given form and tokens as ham or spam.
- 
-     train_mime(msg, encoding, is_spam) -> ''
-         Trains the given MIME message as ham or spam.
- 
-     retrain() -> (nham, nspam)
-         Retrain from scratch on all saved MIME messages.
- 
-     get_corpus(is_spam) -> string
-         Retrieve the current ham or spam corpus (in Unix mbox format).
- 
-     set_corpus(string, is_spam) -> ''
-         Set the current ham or spam corpus (a string in Unix mbox format).
-         Should normally be followed by a call to retrain().
- 
  The following options are available in the Plugin section of the options.
  
--- 29,32 ----
***************
*** 50,55 ****
      xmlrpc_port - port to listen to (default: 5001)
      xmlrpc_path - path to support (default: /sbrpc)
-     hambox - path on server to ham corpus (default: TBD...)
-     spambox - path on server to spam corpus (default: TBD...)
  
  """
--- 34,37 ----
***************
*** 71,76 ****
          ('Plugin',            'xmlrpc_host'),
          ('Plugin',            'xmlrpc_port'),
-         ('Plugin',            'hambox'),
-         ('Plugin',            'spambox'),
          )
  
--- 53,56 ----
***************
*** 89,96 ****
  
      def _dispatch(self, method, params):
!         if method in ("score", "score_mime", "train", "train_mime"):
              return getattr(self, method)(*params)
-         elif method in ("retrain", "get_corpus", "set_corpus"):
-             return "%s not yet implemented" % method
          else:
              raise xmlrpclib.Fault(404, '"%s" is not supported' % method)
--- 69,74 ----
  
      def _dispatch(self, method, params):
!         if method in ("score", "score_mime"):
              return getattr(self, method)(*params)
          else:
              raise xmlrpclib.Fault(404, '"%s" is not supported' % method)
***************
*** 109,123 ****
          return self.state.bayes.spamprob(tokens, evidence=True)
  
-     def train(self, form_dict, extra_tokens, is_spam):
-         """Train the form and extra tokens."""
-         mime_message = form_to_mime(form_dict, extra_tokens)
-         return self.train_mime(mime_message, "ascii", is_spam)
- 
-     def train_mime(self, msg, encoding, is_spam):
-         """Train the message."""
-         tokens = self.tokenize(msg, encoding)
-         self.state.bayes.learn(tokens, is_spam)
-         return ""
- 
      def tokenize(self, msg, encoding):
          """Tokenize the message.  Make sure the bayes instance is 
available."""
--- 87,90 ----

_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to