#!/bin/sh

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

export LANG=ja_JP.UTF-8

mecab-test-gen < corpus.misc.txt > test.misc
mecab-test-gen < corpus.kanjikai.txt > test.kanjikai
mecab-test-gen < corpus.ryomou.txt > test.ryomou
mecab-test-gen < corpus.jts-wa.txt > test.jts-wa
mecab-test-gen < corpus.jts-JP.txt > test.jts-JP

#cat corpus \
#cat corpus.*.txt \
#| 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


cat corpus.misc.txt > corpus
./mk-final.sh
mecab -d ../final/ < test.misc     > test.misc.misc.result
mecab -d ../final/ < test.kanjikai > test.kanjikai.misc.result
mecab -d ../final/ < test.ryomou   > test.ryomou.misc.result
mecab -d ../final/ < test.jts-wa   > test.jts-wa.misc.result
mecab -d ../final/ < test.jts-JP   > test.jts-JP.misc.result

echo '' >> system-eval.results
echo 'test.misc (corpus.misc.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.misc.misc.result corpus.misc.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.kanjikai (corpus.misc.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.kanjikai.misc.result corpus.kanjikai.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.ryomou (corpus.misc.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.ryomou.misc.result corpus.ryomou.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-wa (corpus.misc.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-wa.misc.result corpus.jts-wa.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-JP (corpus.misc.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-JP.misc.result corpus.jts-JP.txt >> system-eval.results


cat corpus.kanjikai.txt > corpus
./mk-final.sh
mecab -d ../final/ < test.misc     > test.misc.kanjikai.result
mecab -d ../final/ < test.kanjikai > test.kanjikai.kanjikai.result
mecab -d ../final/ < test.ryomou   > test.ryomou.kanjikai.result
mecab -d ../final/ < test.jts-wa   > test.jts-wa.kanjikai.result
mecab -d ../final/ < test.jts-JP   > test.jts-JP.kanjikai.result

echo '' >> system-eval.results
echo 'test.misc (corpus.kanjikai.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.misc.kanjikai.result corpus.misc.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.kanjikai (corpus.kanjikai.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.kanjikai.kanjikai.result corpus.kanjikai.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.ryomou (corpus.kanjikai.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.ryomou.kanjikai.result corpus.ryomou.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-wa (corpus.kanjikai.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-wa.kanjikai.result corpus.jts-wa.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-JP (corpus.kanjikai.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-JP.kanjikai.result corpus.jts-JP.txt >> system-eval.results


cat corpus.ryomou.txt > corpus
./mk-final.sh
mecab -d ../final/ < test.misc     > test.misc.ryomou.result
mecab -d ../final/ < test.kanjikai > test.kanjikai.ryomou.result
mecab -d ../final/ < test.ryomou   > test.ryomou.ryomou.result
mecab -d ../final/ < test.jts-wa   > test.jts-wa.ryomou.result
mecab -d ../final/ < test.jts-JP   > test.jts-JP.ryomou.result

echo '' >> system-eval.results
echo 'test.misc (corpus.ryomou.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.misc.ryomou.result corpus.misc.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.kanjikai (corpus.ryomou.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.kanjikai.ryomou.result corpus.kanjikai.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.ryomou (corpus.ryomou.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.ryomou.ryomou.result corpus.ryomou.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-wa (corpus.ryomou.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-wa.ryomou.result corpus.jts-wa.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-JP (corpus.ryomou.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-JP.ryomou.result corpus.jts-JP.txt >> system-eval.results


cat corpus.jts-wa.txt > corpus
./mk-final.sh
mecab -d ../final/ < test.misc     > test.misc.jts-wa.result
mecab -d ../final/ < test.kanjikai > test.kanjikai.jts-wa.result
mecab -d ../final/ < test.ryomou   > test.ryomou.jts-wa.result
mecab -d ../final/ < test.jts-wa   > test.jts-wa.jts-wa.result
mecab -d ../final/ < test.jts-JP   > test.jts-JP.jts-wa.result

echo '' >> system-eval.results
echo 'test.misc (corpus.jts-wa.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.misc.jts-wa.result corpus.misc.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.kanjikai (corpus.jts-wa.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.kanjikai.jts-wa.result corpus.kanjikai.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.ryomou (corpus.jts-wa.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.ryomou.jts-wa.result corpus.ryomou.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-wa (corpus.jts-wa.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-wa.jts-wa.result corpus.jts-wa.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-JP (corpus.jts-wa.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-JP.jts-wa.result corpus.jts-JP.txt >> system-eval.results


cat corpus.jts-JP.txt > corpus
./mk-final.sh
mecab -d ../final/ < test.misc     > test.misc.jts-JP.result
mecab -d ../final/ < test.kanjikai > test.kanjikai.jts-JP.result
mecab -d ../final/ < test.ryomou   > test.ryomou.jts-JP.result
mecab -d ../final/ < test.jts-wa   > test.jts-wa.jts-JP.result
mecab -d ../final/ < test.jts-JP   > test.jts-JP.jts-JP.result

echo '' >> system-eval.results
echo 'test.misc (corpus.jts-JP.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.misc.jts-JP.result corpus.misc.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.kanjikai (corpus.jts-JP.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.kanjikai.jts-JP.result corpus.kanjikai.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.ryomou (corpus.jts-JP.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.ryomou.jts-JP.result corpus.ryomou.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-wa (corpus.jts-JP.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-wa.jts-JP.result corpus.jts-wa.txt >> system-eval.results

echo '' >> system-eval.results
echo 'test.jts-JP (corpus.jts-JP.txt):' >> system-eval.results
mecab-system-eval -l "0 1 2 3 4 5 6 7" \
    test.jts-JP.jts-JP.result corpus.jts-JP.txt >> system-eval.results
