Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1325/Outlook2000

Modified Files:
        filter.py manager.py 
Log Message:
Just pass the bayes_options object to the stats manager rather than lots of 
individual
 options.

This has two consequences: we need to use the same values for the 
classification attribute
 of messages (in filter.py) and we need to ensure that the bayes_options cutoff 
values
 are always the same as the outlook config threshold values.

Index: filter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/filter.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** filter.py   21 Dec 2004 21:48:37 -0000      1.42
--- filter.py   22 Dec 2004 00:30:26 -0000      1.43
***************
*** 17,29 ****
          disposition = "Yes"
          attr_prefix = "spam"
!         msg.c = "spam"
      elif prob_perc >= config.unsure_threshold:
          disposition = "Unsure"
          attr_prefix = "unsure"
!         msg.c = "unsure"
      else:
          disposition = "No"
          attr_prefix = "ham"
!         msg.c = "ham"
  
      ms = mgr.message_store
--- 17,29 ----
          disposition = "Yes"
          attr_prefix = "spam"
!         msg.c = mgr.bayes_options["Headers", "header_spam_string"]
      elif prob_perc >= config.unsure_threshold:
          disposition = "Unsure"
          attr_prefix = "unsure"
!         msg.c = mgr.bayes_options["Headers", "header_unsure_string"]
      else:
          disposition = "No"
          attr_prefix = "ham"
!         msg.c = mgr.bayes_options["Headers", "header_ham_string"]
  
      ms = mgr.message_store

Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.103
retrieving revision 1.104
diff -C2 -d -r1.103 -r1.104
*** manager.py  21 Dec 2004 23:18:32 -0000      1.103
--- manager.py  22 Dec 2004 00:30:26 -0000      1.104
***************
*** 455,468 ****
              self.ReportFatalStartupError("Failed to load bayes database")
              self.classifier_data.InitNew()
!         s_thres = self.config.filter.spam_threshold
!         u_thres = self.config.filter.unsure_threshold
!         fp_cost = bayes_options["TestDriver", "best_cutoff_fp_weight"]
!         fn_cost = bayes_options["TestDriver", "best_cutoff_fn_weight"]
!         unsure_cost = bayes_options["TestDriver",
!                                     "best_cutoff_unsure_weight"]
!         mdb = self.classifier_data.message_db
!         self.stats = bayes_stats.Stats(s_thres, u_thres, mdb, "ham",
!                                        "unsure", "spam", fp_cost, fn_cost,
!                                        unsure_cost)
  
      # Logging - this should be somewhere else.
--- 455,465 ----
              self.ReportFatalStartupError("Failed to load bayes database")
              self.classifier_data.InitNew()
!         self.bayes_options = bayes_options
!         bayes_options["Categorization", "spam_cutoff"] = \
!                                         self.config.filter.spam_threshold
!         bayes_options["Categorization", "ham_cutoff"] = \
!                                         self.config.filter.unsure_threshold
!         self.stats = bayes_stats.Stats(bayes_options,
!                                        self.classifier_data.message_db)
  
      # Logging - this should be somewhere else.
***************
*** 908,911 ****
--- 905,914 ----
          # And re-save now, just incase Outlook dies on the way down.
          self.SaveConfig()
+         # And update the cutoff values in bayes_options (which the
+         # stats use) to our thresholds.
+         bayes_options["Categorization", "spam_cutoff"] = \
+                                         self.config.filter.spam_threshold
+         bayes_options["Categorization", "ham_cutoff"] = \
+                                         self.config.filter.unsure_threshold
          # And tell the addin that our filters may have changed.
          if self.addin is not None:

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

Reply via email to