#!/bin/sh

PATH="/usr/local/bin:/usr/local/libexec/mecab:/bin:/usr/lib/mecab:/usr/local/Cellar/mecab/0.996/libexec/mecab"
export PATH

export LANG=ja_JP.UTF-8

cat corpus.misc.mc corpus.kanjikai.mc corpus.ryomou.mc \
    > corpus.non-KT.mc

cat corpus.KT2.mc corpus.misc.mc corpus.kanjikai.mc corpus.ryomou.mc \
    > corpus.mixed.mc

cat corpus.KT0.mc corpus.misc.mc corpus.kanjikai.mc corpus.ryomou.mc \
    > corpus.all.mc

#CORPUS_LIST="misc kanjikai ryomou jts-wa jts-JP"
CORPUS_LIST="KT0 KT2 misc kanjikai ryomou place-benchmark non-KT mixed all"

for i in $CORPUS_LIST
do
    mecab-test-gen < "corpus.$i.mc" > "test.$i"
done

#cat corpus.*.mc \
#| grep -v EOS | sed 's/	/,0,0,0,/' | sort | uniq > misc.corpus.csv


echo 'mecab-system-eval -l "0 1 2 3 4 5 6 7"' > system-eval.results

for l in $CORPUS_LIST
do
    cat corpus.$l.mc > corpus
    ./mk-final.sh
    for target in $CORPUS_LIST
    do
	mecab -d ../final/ < "test.$target" > "test.$target.$l.result"
	echo '' >> system-eval.results
	echo "test.$target (corpus.$l.mc):" >> system-eval.results
	mecab-system-eval -l "0 1 2 3 4 5 6 7" \
	    "test.$target.$l.result" "corpus.$target.mc" \
	    >> system-eval.results
    done
done
