Skip to content

Commit 5d5fa54

Browse files
committed
[Template merge] speller quality checks
1 parent 28484b0 commit 5d5fa54

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

m4/giella-config-files.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ AC_CONFIG_FILES([src/fst/phonetics/tests/run_tests.sh],
6969
[chmod a+x src/fst/phonetics/tests/run_tests.sh])
7070
AC_CONFIG_FILES([tools/spellcheckers/test/test-zhfst-file.sh], \
7171
[chmod a+x tools/spellcheckers/test/test-zhfst-file.sh])
72+
AC_CONFIG_FILES([tools/spellcheckers/test/suggestion-quality.sh], \
73+
[chmod a+x tools/spellcheckers/test/suggestion-quality.sh])
7274
AC_CONFIG_FILES([tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh], \
7375
[chmod a+x tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh])
7476
AC_CONFIG_FILES([test/run-yaml-testcases.sh], \

tools/spellcheckers/test/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif # WANT_SPELLERS
2424

2525
# List tests that are presently (expected) failures here (in addition to above),
2626
# ie things that should be fixed *later*, but is not critical at the moment:
27-
XFAIL_TESTS=run-spellers-gt-norm-yaml-testcases.sh
27+
XFAIL_TESTS=run-spellers-gt-norm-yaml-testcases.sh suggestion-quality.sh
2828

2929

3030
include $(top_srcdir)/../giella-core/am-shared/tools-spellcheckers-test-include.am
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# colours
4+
if test -f "$GIELLA_CORE/scripts/termcolors.bash" ; then
5+
. "$GIELLA_CORE/scripts/termcolors.bash"
6+
fi
7+
# settings:
8+
TESTER=@DIVVUN_ACCURACY@
9+
THRESHOLD=75
10+
TYPOS="@top_srcdir@/test/data/typos.txt"
11+
ZHFST="@builddir@/../@GTLANG2@.zhfst"
12+
13+
if test x$TESTER = xfalse ; then
14+
printf "%sSKIP%s: missing divvunspell accuracy\n" "$light_blue" "$reset"
15+
exit 77
16+
fi
17+
if test ! -f "$ZHFST" ; then
18+
printf "%sSKIP%s: spellchecker %s not found\n" \
19+
"$light_blue" "$reset" "$ZHFST"
20+
exit 77
21+
fi
22+
if test ! -f "$TYPOS" ; then
23+
printf "%sSKIP%s: test data %s not found\n" "$light_blue" "$reset" "$TYPOS"
24+
exit 77
25+
fi
26+
# run accuracy on typos
27+
$TESTER -T $THRESHOLD "$TYPOS" "$ZHFST"
28+
rv=$?
29+
if test $rv == 77 ; then
30+
printf "%sSKIP%s\n" "$light_blue" "$reset"
31+
exit 77
32+
elif test $rv -gt 0 ; then
33+
printf "%sFAIL%s\n" "$red" "$reset"
34+
exit 1
35+
else
36+
printf "%sPASS%s\n" "$green" "$reset"
37+
exit 0
38+
fi

0 commit comments

Comments
 (0)