1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#!/bin/sh
TOOLDIR=../../tools/src
TOOL=
FORMAT_TOOL=
COMPARE_TOOL=
if [ "$1" = '--python' ]; then
TOOL="python3 ./hfst-strings2fst.py"
FORMAT_TOOL="python3 ./hfst-format.py"
COMPARE_TOOL="python3 ./hfst-compare.py"
else
TOOL=$TOOLDIR/hfst-strings2fst
FORMAT_TOOL=$TOOLDIR/hfst-format
COMPARE_TOOL=$TOOLDIR/hfst-compare
for tool in $TOOL $FORMAT_TOOL $COMPARE_TOOL; do
if ! test -x $tool; then
exit 77;
fi
done
fi
if [ "$srcdir" = "" ]; then
srcdir="./";
fi
for i in "" .sfst .ofst .foma; do
if ((test -z "$i") || $FORMAT_TOOL --list-formats | grep $i > /dev/null); then
FFLAG=
case $i in
.sfst)
FFLAG="-f sfst";;
.ofst)
FFLAG="-f openfst-tropical";;
.foma)
FFLAG="-f foma";;
*)
FFLAG=;;
esac
if test -f cat$i ; then
if ! $TOOL $FFLAG $srcdir/cat.strings > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test cat$i ; then
exit 1
fi
rm test
if ! $TOOL $FFLAG -S $srcdir/c_a_t.strings > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test cat$i ; then
exit 1
fi
rm test
fi
if test -f heavycat$i ; then
if ! $TOOL $FFLAG $srcdir/heavycat.strings > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test heavycat$i ; then
exit 1
fi
rm test
fi
if test -f cat2dog$i ; then
if ! $TOOL $FFLAG $srcdir/cat2dog.strings > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test cat2dog$i > /dev/null 1>&1 ; then
exit 1
fi
if ! $TOOL $FFLAG -S $srcdir/cat2dog.spaces > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test cat2dog$i > /dev/null 1>&1 ; then
exit 1
fi
if ! $TOOL $FFLAG -p -S $srcdir/cat2dog.pairs > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test cat2dog$i > /dev/null 1>&1 ; then
exit 1
fi
if ! $TOOL $FFLAG -p $srcdir/cat2dog.pairstring > test ; then
exit 1
fi
if ! $COMPARE_TOOL -s test cat2dog$i > /dev/null 1>&1 ; then
exit 1
fi
if ! $TOOL $FFLAG $srcdir/dos.strings > test.hfst ; then
exit 1
fi
if ! $COMPARE_TOOL -s test.hfst cat$i ; then
exit 1
fi
rm test.hfst
fi
fi
done
|