# Path contains my path to wapiti and "." the current directory (for the scripts)
export PATH="$PATH:/home/alex/src/wapiti-1.5.0:."

# Create train, dev, devtest
rm -f train.txt
for a in `cat TRAINLIST` 
do
   cat $a | perl extract_003.pl >> train.txt
done

rm -f dev.txt
for a in `cat DEVLIST` 
do
   cat $a | perl extract_003.pl >> dev.txt
done

rm -f test.txt
for a in `cat DEVTESTLIST` 
do
   cat $a | perl extract_003.pl >> test.txt
done

# train model
wapiti train -p unigram_bigram_pattern.txt train.txt unigram_bigram_pattern.model

# get results
echo train
wapiti label --check -m unigram_bigram_pattern.model train.txt > tmp_check

echo labeling train for diffing purposes
cat train.txt | remove_col_nowarn.pl -1 > tmp_train
wapiti label -m unigram_bigram_pattern.model tmp_train > tmp_train_check 2> /dev/null

echo dev
wapiti label --check -m unigram_bigram_pattern.model dev.txt > tmp_check

echo labeling dev for diffing purposes
cat dev.txt | remove_col_nowarn.pl -1 > tmp_dev
wapiti label -m unigram_bigram_pattern.model tmp_dev > tmp_dev_check 2> /dev/null

echo test
wapiti label --check -m unigram_bigram_pattern.model test.txt > tmp_check
