Skip to content

Commit

Permalink
[Template merge] speller quality checks
Browse files Browse the repository at this point in the history
  • Loading branch information
flammie committed Jan 29, 2025
1 parent 158e79c commit 2056bbf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions m4/giella-config-files.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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], \
Expand Down
2 changes: 1 addition & 1 deletion tools/spellcheckers/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 38 additions & 0 deletions tools/spellcheckers/test/suggestion-quality.sh.in
Original file line number Diff line number Diff line change
@@ -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@/../@[email protected]"

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

0 comments on commit 2056bbf

Please sign in to comment.