nltk wordnet concurrency error WordNetError

Created on 12 Jul 2019  ·  4Comments  ·  Source: nltk/nltk

When running wordnet in multiple threads I get strange errors.
I am trying to get the synsets of a word.
Is Wordnet thread safe? Is there a way to solve it? If there is not immediate solution, where is the database of all words and their functions (verb/adjective/noun) stored?

The exceptions look like this:

raise WordNetError('line %r: %s' % (data_file_line, e))
  File "/usr/local/lib/python2.7/dist-packages/nltk/corpus/reader/wordnet.py", line 1342, in synset_from_pos_and_offs
et
    assert synset._offset == offset
*******************************************WordNetError: line u'02203362 40 v 03 have 0 have_got 0 hold 0 013 + 13244109 n 0303 + 10529202630189 42 v 02 have 0 feature 0 023 $ 02203362 v 0000 $ 02204692 v 0000 + 05601758 n 0201 + 05849789 n 0201 ! 02632353 v 0102 ~ 00047610 v 0000 ~ 00047745 v 0000 ~ 01123609 v 0000 ~ 02630734 v 0000 ~ 02630871 v 0000 ~ 02631005 v 0000 ~ 02631163 v 0000 ~ 02631349 v 0000 ~ 02631659 v 0000 ~ 02632167 v 0000 ~ 02636132 v 0000 ~ 02715456 v 0000 ~ 02715595 v 0000 ~ 02715812 v 0000 ~ 02717102 v 0000 ~ 02730813 v 0000 ~ 02740034 v 000at can only carry a small sail"  \n': need more than 1 value to unpack
AssertionError
bug wordnet

All 4 comments

I have this same issue. I'll report back if I find a solution.

Any solution to this issue?

I gave up and just waited for it.

Sorry this code is not threadsafe.

Was this page helpful?
0 / 5 - 0 ratings