opencog / link-grammar

The CMU Link Grammar natural language parser
GNU Lesser General Public License v2.1
389 stars 119 forks source link

Apparent Hunspell problem seen in Debian build of 5.12.3 #1513

Open ampli opened 7 months ago

ampli commented 7 months ago

See: https://buildd.debian.org/status/fetch.php?pkg=link-grammar&arch=amd64&ver=5.12.3%7Edfsg-1.1%7Eexp1&stamp=1706921127&raw=0

Configure arguments: ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=\${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --disable-static --enable-pthreads --with-hunspell-dictdir=/usr/share/hunspell

From the output of configure:

checking for hunspell... yes
checking for hunspell.h... yes

But the tests that involve spelling fail:

............................................s...............s.s...F....E..............s.s...................................
======================================================================
ERROR: test_en_spell_word_positions (__main__.IWordPositionTestCase.test_en_spell_word_positions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/bindings/python-examples/./tests.py", line 836, in test_en_spell_word_positions
    linkage_testfile(self, self.d_en, po, 'pos-spell')
  File "/<<PKGBUILDDIR>>/bindings/python-examples/./tests.py", line 1473, in linkage_testfile
    while getwordpos(linkage) != wordpos:
          ^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/bindings/python-examples/./tests.py", line 1397, in getwordpos
    for wi, w in enumerate(lkg.words()):
                           ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'words'

======================================================================
FAIL: test_d_spell_guessing_on (__main__.HEnglishLinkageTestCase.test_d_spell_guessing_on)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/bindings/python-examples/./tests.py", line 665, in test_d_spell_guessing_on
    self.assertEqual(list(resultx.words()) if resultx else [],
AssertionError: Lists differ: ['LEF[14 chars], 'love.v', 'going.v', 'to.r', 'shoop[?].v', '.', 'RIGHT-WALL'] != ['LEF[14 chars], 'love.v', 'going.v', 'to.r', 'shop[~].v', '.', 'RIGHT-WALL']

First differing element 5:
'shoop[?].v'
'shop[~].v'

  ['LEFT-WALL',
   'I.p',
   'love.v',
   'going.v',
   'to.r',
-  'shoop[?].v',
?      -  ^

+  'shop[~].v',
?        ^

   '.',
   'RIGHT-WALL']

----------------------------------------------------------------------
Ran 124 tests in 8.222s

FAILED (failures=1, errors=1, skipped=5)

FAIL tests.py (exit status: 1)

============================================================================
Testsuite summary for link-grammar 5.12.3
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

EDIT: From the version string we can see it has been compiled with -DHAVE_HUNSPELL=1 -DHUNSPELL_DICT_DIR="/usr/share/hunspell":

Configuration (features):
    DICTIONARY_DIR=/usr/share/link-grammar
    -DPACKAGE_NAME="link-grammar" -DPACKAGE_TARNAME="link-grammar" -DPACKAGE_VERSION="5.12.3" -DPACKAGE_STRING="link-grammar 5.12.3" -DPACKAGE_BUGREPORT="https://github.com/opencog/link-grammar" -DPACKAGE_URL="https://www.abisource.com/projects/link-grammar" -DPACKAGE="link-grammar" -DVERSION="5.12.3" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_THREADS_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DYYTEXT_POINTER=1 -DHAVE_STRNDUP=1 -DHAVE_STRTOK_R=1 -DHAVE_SIGACTION=1 -DHAVE_ALIGNED_ALLOC=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 -DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DHAVE_PRCTL=1 -D__STDC_FORMAT_MACROS=1 -D__STDC_LIMIT_MACROS=1 -DTLS=_Thread_local -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DHAVE_VISIBILITY=1 -DHAVE_LOCALE_T_IN_LOCALE_H=1 -DHAVE_STDATOMIC_H=1 -DUSE_WORDGRAPH_DISPLAY=1 -DHAVE_SQLITE3=1 -DHAVE_HUNSPELL=1 -DHUNSPELL_DICT_DIR="/usr/share/hunspell" -DHAVE_EDITLINE=1 -DHAVE_WIDECHAR_EDITLINE=1 -DHAVE_PCRE2_H=1 -DHAVE_MAYBE_UNINITIALIZED=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DSTRERROR_R_CHAR_P=1
City-busz commented 3 months ago

I experienced the same on Arch Linux. Installing the en_US Hunspell dictionary into the build environment solves the problem.