[Spambayes] Re: notes on sb_server

Anthony Baxter anthony at interlink.com.au
Sun Jan 11 19:10:22 EST 2004


>>> Anthony Baxter wrote
>   An optional setting to say "discard everything < 0.02 and > 0.98"
> would be good - I believe someone offered patches for this on the
> weekend.

Here's a version I just whipped up. If this looks good to folks, 
I can commit it...

RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.98
diff -u -r1.98 Options.py
--- spambayes/Options.py        5 Jan 2004 17:40:25 -0000       1.98
+++ spambayes/Options.py        12 Jan 2004 00:08:44 -0000
@@ -910,6 +910,18 @@
      is classified as unsure?""",
      ("ham", "spam", "discard", "defer"), RESTORE),
 
+    ("ham_discard_level", "Ham Discard Level", 0,
+     """Hams scoring less than this percentage will default to being
+        discarded in the training interface (they won't be trained).
+        trained on.""",
+     INTEGER, RESTORE),
+
+    ("spam_discard_level", "Spam Discard Level", 100,
+     """Spams scoring more than this percentage will default to being 
+        discarded in the training interface (they won't be trained).
+        trained on.""",
+     INTEGER, RESTORE),
+
     ("http_authentication", "HTTP Authentication", "None",
      """This option lets you choose the security level of the web interface.
      When selecting Basic or Digest, the user will be prompted a login and a
Index: spambayes/ProxyUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ProxyUI.py,v
retrieving revision 1.38
diff -u -r1.38 ProxyUI.py
--- spambayes/ProxyUI.py        7 Jan 2004 06:04:44 -0000       1.38
+++ spambayes/ProxyUI.py        12 Jan 2004 00:08:44 -0000
@@ -138,6 +138,8 @@
     ('html_ui',             'default_ham_action'),
     ('html_ui',             'default_spam_action'),
     ('html_ui',             'default_unsure_action'),
+    ('html_ui',             'ham_discard_level'),
+    ('html_ui',             'spam_discard_level'),
     ('html_ui',             'allow_remote_connections'),
     ('html_ui',             'http_authentication'),
     ('html_ui',             'http_user_name'),
@@ -289,11 +291,18 @@
             unused, unused, messageInfo.received = \
                     self._getTimeRange(self._keyToTimestamp(key))
             row = self.html.reviewRow.clone()
+            score = float(messageInfo.score.rstrip('%'))
             if label == 'Spam':
-                r_att = getattr(row, options["html_ui",
+                if score > options["html_ui", "spam_discard_level"]:
+                    r_att = getattr(row, 'discard')
+                else:
+                    r_att = getattr(row, options["html_ui",
                                            "default_spam_action"])
             elif label == 'Ham':
-                r_att = getattr(row, options["html_ui",
+                if score < options["html_ui", "ham_discard_level"]:
+                    r_att = getattr(row, 'discard')
+                else:
+                    r_att = getattr(row, options["html_ui",
                                            "default_ham_action"])
             else:
                 r_att = getattr(row, options["html_ui",




More information about the Spambayes mailing list