[Spambayes] Comparable bogoutil functionality?

Meyer, Tony T.A.Meyer at massey.ac.nz
Mon Sep 22 23:42:26 EDT 2003


> What's a spambayes-y or Python-y way to implement bogoutil 
> for my hammiedb?  It's a convenient way of checking to see 
> what bogofilter thinks about a token.  For instance:
> 
>    $ bogoutil -w ~/.bogofilter penis
>                           spam   good
>    penis                  3393      0
>    $ bogoutil -w ~/.bogofilter viagra
>                           spam   good
>    viagra                   64      0
>    $ bogoutil -w ~/.bogofilter raines
>                           spam   good
>    raines                    0    171

It may not be the best way, but one way is to:

$ sb_server.py -b

Then in the 'word query' box at the bottom of the web page that opens,
type your word and press enter, and there you go.

It would be easy enough to copy out the code that does this if you
wanted a script that would do it.  Something like (untested):

>>> from spambayes.storage import open_storage
>>> db = open_storage(filename[, use_db, mode])
>>> wordinfo = db._wordinfoget(word)
>>> if wordinfo: print "%s\t%d\t%d\t%d" % (word, wordinfo.spamcount,
wordinfo.hamcount, db.probability(wordinfo)

HTH.

=Tony Meyer



More information about the Spambayes mailing list