Python nltk udhr模块中存在错误

Python nltk udhr模块中存在错误,python,python-2.7,ubuntu-14.04,nltk,Python,Python 2.7,Ubuntu 14.04,Nltk,使用python运行NLP中的代码段时出错。如下所示 >>> from nltk.corpus import udhr >>> languages = ['Chickasaw','English','German_Deutsh', ... 'Greenlandic_Inuktikut','Hungarian_Magyar','Ibibio_Efik'] >>> cfd = nltk.ConditionalFreqDist( ...

使用python运行NLP中的代码段时出错。如下所示

>>> from nltk.corpus import udhr
>>> languages = ['Chickasaw','English','German_Deutsh',
...     'Greenlandic_Inuktikut','Hungarian_Magyar','Ibibio_Efik']
>>> cfd = nltk.ConditionalFreqDist(
...             (lang,len(word))
...             for lang in languages
...             for word in udhr.words(lang + '-Latin1'))
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/usr/local/lib/python2.7/dist-packages/nltk/probability.py", line 1729, in __init__
    for (cond, sample) in cond_samples:
  File "<stdin>", line 4, in <genexpr>
  File "/usr/local/lib/python2.7/dist-packages/nltk/corpus/reader/plaintext.py", line 91, in words
    in self.abspaths(fileids, True, True)])
  File "/usr/local/lib/python2.7/dist-packages/nltk/corpus/reader/api.py", line 167, in abspaths
    paths = [self._root.join(f) for f in fileids]
  File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 176, in join
    return FileSystemPathPointer(path)
  File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 154, in __init__
    raise IOError('No such file or directory: %r' % path)
IOError: No such file or directory: '/home/anupam/nltk_data/corpora/udhr/German_Deutsh-Latin1'
>>从nltk.corpus导入udhr
>>>语言=['Chickasaw'、'English'、'German_Deutsh',
“‘格陵兰语’、‘匈牙利语’、‘伊比比奥语’”
>>>cfd=nltk.ConditionalFreqDist(
…(朗、伦(字))
…语言中的朗
…用于udhr中的单词。单词(lang+'-Latin1'))
回溯(最近一次呼叫最后一次):
文件“”,第3行,在
文件“/usr/local/lib/python2.7/dist packages/nltk/probability.py”,第1729行,在__
对于cond_样品中的(cond,样品):
文件“”,第4行,在
文件“/usr/local/lib/python2.7/dist packages/nltk/corpus/reader/plaintext.py”,第91行,大写
在self.abspaths中(fileid,True,True)])
文件“/usr/local/lib/python2.7/dist packages/nltk/corpus/reader/api.py”,第167行,在abspaths中
路径=[self.\u root.join(f)for f in fileid]
文件“/usr/local/lib/python2.7/dist packages/nltk/data.py”,第176行,在join中
返回文件系统指针(路径)
文件“/usr/local/lib/python2.7/dist packages/nltk/data.py”,第154行,在__
raise IOError('没有这样的文件或目录:%r'%path)
IOError:没有这样的文件或目录:'/home/anupam/nltk_data/corpora/udhr/German_Deutsh-Latin1'
我已经导入了所需的模块,如 导入nltk 我是python新手,有人能告诉我错误到底是什么吗?

您输入了一个错误:

它应该是
German\u Deutsch
而不是
German\u Deutsch

见第1.7节:

请注意,堆栈跟踪的最后一行表示无法加载的语料库,如果您再次遇到此问题,这应该是一个提示