ValueError with nltk on python 3.6 Windows

273 views Asked by At

Tried to run

wordnet.synsets('table')

from Python 3.6 on Windows and got

     File "<stdin>", line 1, in <module>
  File "C:\Users\Leti\Anaconda3\envs\DeepVis\lib\site-packages\nltk\corpus\reader\wordnet.py", line 1424, in synsets
    for p in pos
  File "C:\Users\Leti\Anaconda3\envs\DeepVis\lib\site-packages\nltk\corpus\reader\wordnet.py", line 1426, in <listcomp>
    for offset in index[form].get(p, [])]
  File "C:\Users\Leti\Anaconda3\envs\DeepVis\lib\site-packages\nltk\corpus\reader\wordnet.py", line 1280, in _synset_from_pos_and_offset
    synset = self._synset_from_pos_and_line(pos, data_file_line)
  File "C:\Users\Leti\Anaconda3\envs\DeepVis\lib\site-packages\nltk\corpus\reader\wordnet.py", line 1381, in _synset_from_pos_and_line
    raise WordNetError('line %r: %s' % (data_file_line, e))
nltk.corpus.reader.wordnet.WordNetError: line 'tted dalmatian  \r\n': not enough values to unpack (expected 2, got 1)

On Linux it works just fine!

Does someone know what is happening?

1

There are 1 answers

0
michael jie On

try to convert file nltk_data\corpora\wordnet\data.noun format to Unix by tools like UltraEdit or notepad++ (Edit-->EOL Conversion-->Unix(LF))