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
|
#!/bin/sh
TOOLDIR=../../tools/src
CI_TOOL=
CALCULATE_TOOL=
COMPARE_TOOL=
if [ "$1" = '--python' ]; then
CI_TOOL="python3 ./hfst-compose-intersect.py"
CALCULATE_TOOL="python3 ./hfst-calculate.py"
COMPARE_TOOL="python3 ./hfst-compare.py"
else
CI_TOOL=$TOOLDIR/hfst-compose-intersect
CALCULATE_TOOL=$TOOLDIR/hfst-calculate
COMPARE_TOOL=$TOOLDIR/hfst-compare
for tool in $CI_TOOL $CALCULATE_TOOL $COMPARE_TOOL;
do
if ! test -x $tool; then
exit 77;
fi
done
fi
for i in "" .sfst .ofst .foma; do
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 ! echo "cat|dog" | $CALCULATE_TOOL $FFLAG > lexicon ; then
exit 1
fi
if ! echo "([catdog]|d:D|c:C)*" | $CALCULATE_TOOL $FFLAG > rules ; then
exit 1
fi
if ! echo "([catdog]|d:D|c:C)*" | $CALCULATE_TOOL $FFLAG >> rules ; then
exit 1
fi
if ! $CI_TOOL -1 lexicon -2 rules > test ; then
exit 1
fi
if ! echo "cat|dog|{cat}:{Cat}|{dog}:{Dog}" | $CALCULATE_TOOL $FFLAG > test2 ; then
exit 1
fi
if ! $COMPARE_TOOL -s test test2 ; then
exit 1
fi
rm test test2 lexicon rules
fi
done
|