#!/bin/sh

# set SCORESET
. config

if [ "x$1" != "x" ]; then
 SCORESET=$1
fi

echo "STATISTICS REPORT FOR SPAMASSASSIN RULESET"
echo 
echo "Classification success on test corpora, at default threshold:"
echo

./logs-to-c --spam=spam-validate.log --ham=ham-validate.log --threshold 5 --count --scoreset=$SCORESET | sed -e 's/^Reading.*//' -e '/^$/d'

echo
echo "Results on test corpora at various alternative thresholds:"
echo

# list a wide range of thresholds, so that we can make graphs later ;)
for thresh in -4 -3 -2 -1 0 1 2 3 4 4.5 5.5 6 6.5 7 8 9 10 12 15 17 20 ; do
  ./logs-to-c --spam=spam-validate.log --ham=ham-validate.log --threshold $thresh --count --scoreset=$SCORESET | sed -e 's/^Reading.*//' -e '/^$/d'
  echo
done

echo
echo "Test hit frequencies, for spam and ham corpora:"
echo "(note: S/O indicates ratio of spam hits to overall hits for"
echo "each test, where 0.0 = hits only non-spam and 1.0 = hits only spam,"
echo "and the 'score' field should be ignored.)"
echo
cat freqs

version=`( cd .. ; ./build/get_version )`
echo
echo "Rule file versions for which these results apply:"
echo "(SpamAssassin Version string: $version)"
echo

( cd ../rules ; ls -l *.cf )
