1

试图跑

wordnet.synsets('table')

从 Windows 上的 Python 3.6 得到

     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)

在 Linux 上它工作得很好!

有人知道发生了什么吗?

4

1 回答 1

0

尝试nltk_data\corpora\wordnet\data.noun通过 UltraEdit 或 notepad++ 等工具将文件格式转换为 Unix(编辑-->EOL 转换-->Unix(LF))

于 2019-11-12T07:30:21.830 回答