Delete mert/sample/README; Add smoke tests.

Replace README with a bunch of shell script
for smoke testing of MERT.

The README file was not a typical README file.
It was like a sample script to run mert and
extractor, so I renamed it as smoke tests stuff.
This commit is contained in:
Tetsuo Kiso 2012-02-17 03:53:52 +09:00
parent faea0c3ea3
commit 91645503e8
4 changed files with 108 additions and 26 deletions

View File

@ -1,26 +0,0 @@
extractor=../extractor
#extractor="../extractor --binary"
mert=../mert
size=15
#to read an nbest file; output is in text format
$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 --ffile FEATSTAT --scfile SCORESTAT --sctype BLEU
$extractor --ffile FEATSTAT.2 --scfile SCORESTAT.2 --sctype BLEU --prev-ffile FEATSTAT --prev-scfile SCORESTAT
$extractor --binary --ffile FEATSTAT.3 --scfile SCORESTAT.3 --sctype BLEU --prev-ffile FEATSTAT,FEATSTAT.2 --prev-scfile SCORESTAT,SCORESTAT.2
$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 --ffile FEATSTAT.4 --scfile SCORESTAT.4 --sctype BLEU --prev-ffile FEATSTAT,FEATSTAT.3 --prev-scfile SCORESTAT,SCORESTAT.3
$mert -r 1234 --ifile init.opt --scfile SCORESTAT --ffile FEATSTAT -d $size --verbose 4 -n 5
exit
#to read a gzipped nbest file; output is in text format
$extractor --nbest NBEST.gz --reference REF.0,REF.1,REF.2 --ffile FEATSTATgz --scfile SCORESTATgz --sctype BLEU
gzip FEATSTATgz SCORESTATgz
$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 --prev-ffile FEATSTAT --prev-scfile SCORESTAT --ffile FEATSTAT2 --scfile SCORESTAT2 --sctype BLEU
$extractor --nbest NBEST.gz --reference REF.0,REF.1,REF.2 --prev-ffile FEATSTATgz.gz --prev-scfile SCORESTATgz.gz --ffile FEATSTAT2gz --scfile SCORESTAT2gz --sctype BLEU
exit

39
mert/example/gzipped_test.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
extractor=$1
mert=$2
size=$3
if [ $# -ne 3 ]; then
echo "Usage: ./normal_test.sh extracto mert size"
exit 1
fi
if ! [ -f NBEST.gz ]; then
gzip NBEST
fi
$extractor --nbest NBEST.gz --reference REF.0,REF.1,REF.2 \
--ffile FEATSTAT_gz --scfile SCORESTAT_gz \
--sctype BLEU 2> extractor_gz1.log
$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 \
--prev-ffile FEATSTAT --prev-scfile SCORESTAT \
--ffile FEATSTAT2 --scfile SCORESTAT2 \
--sctype BLEU 2> extractor_gz2.log
# Now we want to test reading gzipped files.
# We will first compress the output previously.
for f in FEATSTAT_gz SCORESTAT_gz; do
printf "Compressing %s " $f
gzip $f
echo "done."
done
$extractor --nbest NBEST.gz --reference REF.0,REF.1,REF.2 \
--prev-ffile FEATSTAT_gz.gz --prev-scfile SCORESTAT_gz.gz \
--ffile FEATSTAT2_gz --scfile SCORESTAT2_gz \
--sctype BLEU 2> extractor_gz3.log
gzip -d NBEST.gz FEATSTAT_gz.gz SCORESTAT_gz.gz
echo "Done."

30
mert/example/normal_test.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
extractor=$1
mert=$2
size=$3
if [ $# -ne 3 ]; then
echo "Usage: ./normal_test.sh extracto mert size"
exit 1
fi
echo "Runnning extractor ..."
$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 --ffile FEATSTAT \
--scfile SCORESTAT --sctype BLEU 2> extractor1.log
$extractor --ffile FEATSTAT.2 --scfile SCORESTAT.2 --sctype BLEU \
--prev-ffile FEATSTAT --prev-scfile SCORESTAT 2> extractor2.log
$extractor --binary --ffile FEATSTAT.3 --scfile SCORESTAT.3 --sctype BLEU \
--prev-ffile FEATSTAT,FEATSTAT.2 \
--prev-scfile SCORESTAT,SCORESTAT.2 2> extractor3.log
$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 --ffile FEATSTAT.4 \
--scfile SCORESTAT.4 --sctype BLEU --prev-ffile FEATSTAT,FEATSTAT.3 \
--prev-scfile SCORESTAT,SCORESTAT.3 2> extractor4.log
echo "Running mert ..."
$mert -r 1234 --ifile init.opt --scfile SCORESTAT --ffile FEATSTAT \
-d $size --verbose 4 -n 5 2>mert.log
echo "Done."

39
mert/example/smoke_test.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# A sample script for smoke testing.
# This is not tuning script.
# Please see: mosesdecoder/scripts/training/mert-moses.pl
extractor=../extractor
mert=../mert
# Default the dimension used in mert.
size=15
# Make sure you have already compiled mert related stuff.
for f in $extractor $mert; do
if ! [ -f $f ]; then
echo "Error: no such file or directory: $f"
echo "You should run `bjam` first!"
exit 1
fi
done
# Make sure you have sample data and inifile used in this tests.
for f in NBEST REF.0 REF.1 REF.2 init.opt; do
if ! [ -f $f ]; then
echo "Error: no such file or directory: $f"
exit 1
fi
done
# Read an nbest file, Print output in text format.
# We will save stderr to disk. Please see each log file.
echo "Running tests for reading text files ..."
./normal_test.sh $extractor $mert $size
# Run reading gzipped file tests.
# We will save stderr to disk. Please see each log file.
echo "Running tests for reading gzipped files ..."
./gzipped_test.sh $extractor $mert $size
echo "Smoke tests done."