[Spambayes] Habeas Headers
Meyer, Tony
T.A.Meyer at massey.ac.nz
Wed Feb 19 12:43:49 EST 2003
Hi all,
Does anyone else here use the Habeas headers?
<http://www.habeas.com>
Since I do, I patched my spambayes to add tokens for the habeas headers. If anyone else wants to, the code is attached.
I'm not suggesting that this becomes a permanent modification to the spambayes code - given that Habeas is relatively new, it's unlikely to be in a lot of ham (unless your ham is from particular places) yet, and so would not make all that much difference to the FN/FP rates, and I agree that the code shouldn't bloat with unnecessary additions. It does help me a little (correctly moving mail from possible-spam to ham).
In the event that Habeas catches on, however, it might be useful :)
Cheers,
Tony Meyer
-------------- next part --------------
[Add the following code to tokenizer.py, pretty much anywhere. I have it just before subject]
# Habeas Headers - see http://www.habeas.com
if options.search_for_habeas_headers:
habeas_headers = [
("X-Habeas-SWE-1", "winter into spring"),
("X-Habeas-SWE-2", "brightly anticipated"),
("X-Habeas-SWE-3", "like Habeas SWE (tm)"),
("X-Habeas-SWE-4", "Copyright 2002 Habeas (tm)"),
("X-Habeas-SWE-5", "Sender Warranted Email (SWE) (tm). The sender of this"),
("X-Habeas-SWE-6", "email in exchange for a license for this Habeas"),
("X-Habeas-SWE-7", "warrant mark warrants that this is a Habeas Compliant"),
("X-Habeas-SWE-8", "Message (HCM) and not spam. Please report use of this"),
("X-Habeas-SWE-9", "mark in spam to <http://www.habeas.com/report/>.")
]
valid_habeas = 0
invalid_habeas = False
for opt, val in habeas_headers:
habeas = msg.get(opt)
if habeas is not None:
if options.reduce_habeas_headers and habeas == val:
valid_habeas = valid_habeas + 1
elif options.reduce_habeas_headers and habeas != val:
invalid_habeas = True
elif (not options.reduce_habeas_headers) and habeas == val:
yield opt.lower() + ":valid"
else:
yield opt.lower() + ":invalid"
if options.reduce_habeas_headers:
# if there was any invalid line, we record as invalid
# if all nine lines were correct, we record as valid
# otherwise we ignore
if invalid_habeas == True:
yield "x-habeas-swe:invalid"
elif valid_habeas == 9:
yield "x-habeas-swe:valid"
[Add the following code to Options.py, anywhere in the [Tokenizer] section]
# If true, search for the habeas headers (see http://www.habeas.com)
# If they are present and correct, this is a strong ham sign, if they are
# present and incorrect, this is a strong spam sign
search_for_habeas_headers: False
# If search_for_habeas_headers is set, nine tokens are generated for
# messages with habeas headers. This should be fine, since messages with
# the headers should either be ham, or result in FN so that we can send
# them to habeas so they can be sued. However, to reduce the strength
# of habeas headers, we offer the ability to reduce the nine tokens to one.
# (this option has no effect if search_for_habeas_headers is False)
reduce_habeas_headers: False
[Add the following code to Options.py, in the Tokenizer section of all_options]
'search_for_habeas_headers': boolean_cracker,
'reduce_habeas_headers': boolean_cracker,
More information about the Spambayes
mailing list