#!/bin/sh

# change these!
NSBASE=ham-logs
SPBASE=spam-logs
SCORESET="0"

passes="1 2 3 4 5 6 7 8 9 10"
mkdir -p tenpass_results
mkdir -p ORIG

> make.output

for id in $passes ; do
  notid=

  echo "Training for corpus $id..."
  pwd; date

  > ORIG/ham-set$SCORESET.log
  > ORIG/spam-set$SCORESET.log

  echo -n "(using corpora blocks: "
  for notid in $passes ; do
    if [ "$notid" != "$id" ] ; then
      echo -n "$notid "
      cat $NSBASE/split-$notid.log >> ORIG/ham-set$SCORESET.log
      cat $SPBASE/split-$notid.log >> ORIG/spam-set$SCORESET.log
    fi
  done
  echo "for training)"

  make clean >> make.output
  make >> make.output 2>&1
  ./runGA
  pwd
  date

  echo "Saving test data for corpus $id..."

  cp $NSBASE/split-$id.log tenpass_results/ham.log.$id
  cp $SPBASE/split-$id.log tenpass_results/spam.log.$id
  cp gen-set$SCORESET.scores tenpass_results/scores.$id
done
