Revision: 3164
          http://spambayes.svn.sourceforge.net/spambayes/?rev=3164&view=rev
Author:   montanaro
Date:     2007-10-21 19:29:03 -0700 (Sun, 21 Oct 2007)

Log Message:
-----------
Use the better of the ratio requested by the user and the actual ratio in
the spam and ham databases.

Modified Paths:
--------------
    trunk/spambayes/contrib/tte.py

Modified: trunk/spambayes/contrib/tte.py
===================================================================
--- trunk/spambayes/contrib/tte.py      2007-10-10 13:20:44 UTC (rev 3163)
+++ trunk/spambayes/contrib/tte.py      2007-10-22 02:29:03 UTC (rev 3164)
@@ -114,10 +114,13 @@
         hambone_ = list(reversed(hambone_))
         spamcan_ = list(reversed(spamcan_))
     
+    nspam,nham = len(spamcan_),len(hambone_)
     if ratio:
         rspam,rham = ratio
-    else:
-        rspam,rham = len(spamcan_),len(hambone_)
+        # If the actual ratio of spam to ham in the database is better than
+        # what was asked for, use that better ratio.
+        if (rspam > rham) == (rspam * nham > rham * nspam):
+            rspam,rham = nspam,nham
 
     # define some indexing constants
     ham = 0


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to