File: pmatch-functionality.sh

package info (click to toggle)
hfst 3.16.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,532 kB
  • sloc: cpp: 101,875; sh: 6,717; python: 5,225; yacc: 4,985; lex: 2,900; makefile: 2,017; xml: 6
file content (45 lines) | stat: -rwxr-xr-x 911 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
TOOLDIR=../../tools/src
TOOL=

if [ "$1" = '--python' ]; then
    TOOL="python3 ./hfst-pmatch.py"
else
    TOOL=$TOOLDIR/hfst-pmatch
    if ! test -x $TOOL; then
	exit 77;
    fi
fi

if [ "$srcdir" = "" ] ; then
    srcdir=. ;
fi
if ! $TOOL pmatch_endtag.pmatch < $srcdir/cat.strings > test.lookups ; then
    exit 1
fi

# test equality of output
if ! echo "cat" | $TOOL pmatch_endtag.pmatch > test.pmatch; 
    then
        exit 1
    fi
    if ! grep -q "<animal>cat</animal>" test.pmatch; then
        echo "FAIL: cat should be tagged as animal"
        exit 1
    fi
    
rm test.pmatch test.lookups

if [ "$1" != '--python' ]; then
    # Jyrki's suite
    if ! $srcdir/pmatch-tests.sh --log none; then
	if [ -e $srcdir/pmatch-tests.sh.* ]; then
            rm $srcdir/pmatch-tests.sh.*
	fi
	exit 1
    fi
    
    if [ -e $srcdir/pmatch-tests.sh.* ]; then
	rm $srcdir/pmatch-tests.sh.*
    fi
fi