diff --git a/m4/giella-config-files.m4 b/m4/giella-config-files.m4 index 568f0ec2..ebd25750 100644 --- a/m4/giella-config-files.m4 +++ b/m4/giella-config-files.m4 @@ -69,6 +69,8 @@ AC_CONFIG_FILES([src/fst/phonetics/tests/run_tests.sh], [chmod a+x src/fst/phonetics/tests/run_tests.sh]) AC_CONFIG_FILES([tools/spellcheckers/test/test-zhfst-file.sh], \ [chmod a+x tools/spellcheckers/test/test-zhfst-file.sh]) +AC_CONFIG_FILES([tools/spellcheckers/test/suggestion-quality.sh], \ + [chmod a+x tools/spellcheckers/test/suggestion-quality.sh]) AC_CONFIG_FILES([tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh], \ [chmod a+x tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh]) AC_CONFIG_FILES([test/run-yaml-testcases.sh], \ diff --git a/tools/spellcheckers/test/Makefile.am b/tools/spellcheckers/test/Makefile.am index 84feba0c..3887e088 100644 --- a/tools/spellcheckers/test/Makefile.am +++ b/tools/spellcheckers/test/Makefile.am @@ -24,7 +24,7 @@ endif # WANT_SPELLERS # List tests that are presently (expected) failures here (in addition to above), # ie things that should be fixed *later*, but is not critical at the moment: -XFAIL_TESTS=run-spellers-gt-norm-yaml-testcases.sh +XFAIL_TESTS=run-spellers-gt-norm-yaml-testcases.sh suggestion-quality.sh include $(top_srcdir)/../giella-core/am-shared/tools-spellcheckers-test-include.am diff --git a/tools/spellcheckers/test/suggestion-quality.sh.in b/tools/spellcheckers/test/suggestion-quality.sh.in new file mode 100644 index 00000000..6aeefa6e --- /dev/null +++ b/tools/spellcheckers/test/suggestion-quality.sh.in @@ -0,0 +1,38 @@ +#!/bin/bash + +# colours +if test -f "$GIELLA_CORE/scripts/termcolors.bash" ; then + . "$GIELLA_CORE/scripts/termcolors.bash" +fi +# settings: +TESTER=@DIVVUN_ACCURACY@ +THRESHOLD=75 +TYPOS="@top_srcdir@/test/data/typos.txt" +ZHFST="@builddir@/../@GTLANG2@.zhfst" + +if test x$TESTER = xfalse ; then + printf "%sSKIP%s: missing divvunspell accuracy\n" "$light_blue" "$reset" + exit 77 +fi +if test ! -f "$ZHFST" ; then + printf "%sSKIP%s: spellchecker %s not found\n" \ + "$light_blue" "$reset" "$ZHFST" + exit 77 +fi +if test ! -f "$TYPOS" ; then + printf "%sSKIP%s: test data %s not found\n" "$light_blue" "$reset" "$TYPOS" + exit 77 +fi +# run accuracy on typos +$TESTER -T $THRESHOLD "$TYPOS" "$ZHFST" +rv=$? +if test $rv == 77 ; then + printf "%sSKIP%s\n" "$light_blue" "$reset" + exit 77 +elif test $rv -gt 0 ; then + printf "%sFAIL%s\n" "$red" "$reset" + exit 1 +else + printf "%sPASS%s\n" "$green" "$reset" + exit 0 +fi