[Spambayes] Getting Evidence

Gerrit Holl gerrit at nl.linux.org
Thu Nov 20 12:53:54 EST 2003


Skip Montanaro wrote:
> How does this help you?  Here are a couple ideas:
> 
>     * modify spamcounts.py to tokenize a message and generate the counts for
>       all tokens.
> 
>     * write a little script which just tokenizes a message and modify
>       spamcounts to take a stream of tokens from stdin.
> 
> Happy hacking...

I have chosen for an even simpler solution:

#!/usr/bin/python

import sys
import email

import spamcounts

m = email.message_from_file(sys.stdin)
if not m["X-Spambayes-Evidence"]:
    sys.exit("No evidence found!")
d = eval("{" + m["X-Spambayes-Evidence"].replace(';', ',') + "}")

spamcounts.main(d.keys())

it's not all that elegant, but it works :)

yours,
Gerrit.

-- 
243. As rent of herd cattle he shall pay three gur of corn to the
owner.
          -- 1780 BC, Hammurabi, Code of Law
-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Kom in verzet tegen dit kabinet:
	http://www.sp.nl/



More information about the Spambayes mailing list