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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
#!/bin/sh
TOOLDIR=../../tools/src
FORMAT_TOOL=$TOOLDIR/hfst-format
FLOOKUP_TOOL=$TOOLDIR/hfst-flookup
if [ "$1" = "--python" ]; then
exit 77 # not yet implemented
FORMAT_TOOL="python3 ./hfst-format.py"
FLOOKUP_TOOL="python3 ./hfst-flookup.py"
fi
if ! $FLOOKUP_TOOL -R -s cat.hfst < $srcdir/cat.strings > test.lookups ; then
exit 1
fi
$FORMAT_TOOL -l > TMP;
# test what strings the transducer [a:b (ID:ID)*] recognizes
for i in "" .sfst .ofst .foma; do
if ((test -z "$i") || $FORMAT_TOOL --list-formats | grep $i > /dev/null); then
if test -f abid$i ; then
if ! echo "aa" | $FLOOKUP_TOOL -R -s abid$i \
> test.lookups;
then
exit 1
fi
if ! grep -q "inf" test.lookups; then
echo "FAIL: string 'aa' should not be recognized"
exit 1
fi
if ! echo "ab" | $FLOOKUP_TOOL -R -s abid$i \
> test.lookups;
then
exit 1
fi
if ! grep -q "inf" test.lookups; then
echo "FAIL: string 'ab' should not be recognized"
exit 1
fi
if ! echo "ac" | $FLOOKUP_TOOL -R -s abid$i \
> test.lookups;
then
exit 1
fi
if grep -q "inf" test.lookups; then
echo "FAIL: string 'ac' should be recognized"
exit 1
fi
if ! echo "aa" | $FLOOKUP_TOOL -s abid$i \
> test.lookups;
then
exit 1
fi
if ! grep -q "inf" test.lookups; then
echo "FAIL: string 'aa' should not be recognized"
exit 1
fi
if ! echo "bc" | $FLOOKUP_TOOL -s abid$i \
> test.lookups;
then
exit 1
fi
if grep -q "inf" test.lookups; then
echo "FAIL: string 'bc' should be recognized"
exit 1
fi
fi
if test -f infinitely_ambiguous$i ; then
if ! echo "ad" | $FLOOKUP_TOOL -R infinitely_ambiguous$i \
2> warnings > test.lookups;
then
exit 1
fi
if ! grep -q "infinite" warnings; then
echo "FAIL: infinitely ambiguous string 'ad' should give a warning"
exit 1;
fi
if ! echo "b" | $FLOOKUP_TOOL -R infinitely_ambiguous$i \
2> warnings > test.lookups;
then
exit 1
fi
if grep -q "infinite" warnings; then
echo "FAIL: unambiguous string 'b' should not give a warning"
exit 1;
fi
fi
if test -f infinitely_ambiguous_with_flags$i ; then
if ! echo "a" | $FLOOKUP_TOOL -R infinitely_ambiguous_with_flags$i \
2> warnings > test.lookups;
then
exit 1
fi
if ! grep -q "infinite" warnings; then
echo "FAIL: infinitely ambiguous string 'a' should give a warning"
exit 1;
fi
if ! echo "b" | $FLOOKUP_TOOL -R infinitely_ambiguous_with_flags$i \
2> warnings > test.lookups;
then
exit 1
fi
if grep -q "infinite" warnings; then
echo "FAIL: unambiguous string 'b' should not give a warning"
exit 1;
fi
fi
fi
done
rm TMP
rm test.lookups
rm warnings
|