Women in Technology

Hear us Roar



Article:
  Bayesian Filtering with bogofilter and Sylpheed Claws
Subject:   Extended bogolearn.sh
Date:   2003-08-21 00:30:02
From:   anonymous2
Here's my addition to bogolearn.sh
It keeps a list of processed good/spam mail so that only new messages are trained into the db


#!/bin/sh
# train bogofilter with new spam and non-spam
BOGOFILTER="/usr/bin/bogofilter";
MAILDIR="/home/jesse/.Mail"
GOODDIR="inbox";
SPAMDIR="Spam";
GOODLIST=".goodlist";
SPAMLIST=".spamlist";


cd $MAILDIR/$SPAMDIR;
echo Spam:
for i in *; do
if [ -z "`grep -e " $i " $MAILDIR/$SPAMLIST`" ]; then
echo Processing Mail ID \#$i;
bogofilter -s -v < $i ;
echo " $i " >> $MAILDIR/$SPAMLIST;
fi
done;


cd $MAILDIR/$GOODDIR;
echo NonSpam:
for i in *; do
if [ -z "`grep -e " $i " $MAILDIR/$GOODLIST`" ]; then
echo Processing Mail ID \#$i;
bogofilter -n -v < $i ;
echo " $i " >> $MAILDIR/$GOODLIST;
fi
done;