File: test-morphologies.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 (43 lines) | stat: -rwxr-xr-x 1,029 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
#!/bin/sh

test_case()
{
    # input on one line
    if ! echo $2 | $1-analyze-words | cut -f 2- > tmp; then
	echo "$1: input \"$2\" (space-separated words) failed"
    fi
    if [ "$3" != "" ]; then
	if test -f "$3"; then 
	    if ! diff tmp $3 > /dev/null; then
		echo "$1: output of \"$2\" (space-separated words) differs from expected"
	    fi
	fi
    fi
    # each word on its own line
    if ! echo $2 | perl -pe 's/ /\n/;' | $1-analyze-words | cut -f 2- > tmp; then
	echo "$1: input \"$2\" (line-separated words) failed"
    fi
    if [ "$3" != "" ]; then
	if test -f "$3"; then 
	    if ! diff tmp $3 > /dev/null; then
		echo "$1: output of \"$2\" (line-separated words) differs from expected"
	    fi
	fi
    fi
}

test_lang()
{
    echo $1
    test_case $1 "$2" "$1-analyze-words.output"
    test_case $1 " "
    test_case $1 ""
}

test_lang "english" "TODO"
test_lang "finnish" "TODO"
test_lang "french" "TODO"
test_case "german" "TODO"
test_lang "italian" "TODO"
test_lang "swedish" "TODO"
test_lang "turkish" "TODO"