On Mon, Oct 20, 2003 at 07:52:36PM +1300, Tony Meyer wrote:
""" *** hammie.py Mon Oct 20 19:51:31 2003 --- hammie2.py Mon Oct 20 19:47:20 2003 *************** *** 116,121 **** --- 116,125 ---- else: is_spam = False disp = options["Headers", "header_unsure_string"] + if disp in options["Headers", "notate_subject"]: + subj = msg["Subject"] + del msg["Subject"] + msg["Subject"] = "%s %s" % (disp, subj) if train: self.train(msg, is_spam, True) disp += ("; %."+str(options["Headers", "header_score_digits"])+"f") % Prob """
First delve into Python, but here goes. I by no means mean to nitpick, but it would be very nice to see the Prob score in the Subject as well. I couldn't get it to work and also look to the config file for which disp to notate, so I hard coded it to make only messages classified as 'spam' appear in the subject with the score. Here is how I do it: """ --- hammie.py.orig Fri Nov 7 09:20:37 2003 +++ hammie.py Tue Nov 11 17:40:55 2003 @@ -130,6 +130,10 @@ disp += " (%d)"%x del msg[header] msg.add_header(header, disp) + if is_spam: + subj = msg["Subject"] + del msg["Subject"] + msg["Subject"] = "[%s] %s" % (disp, subj) if debug: disp = self.formatclues(clues) del msg[debugheader] """ So far, I am VERY happy with how this filter is performing. I am now rolling it out to the rest of my clients, and so far it is well received.