babelize_shell()无效

laz*_*rus 4 python

我正在使用python通过NLP,我发现以下错误:

babelize_shell()
NLTK Babelizer: type 'help' for a list of commands.
Babel> how long before the next flight to Alice Springs?
Babel> german
Babel> run
0> how long before the next flight to Alice Springs?
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/nltk/misc/babelfish.py", line 175, in babelize_shell
    for count, new_phrase in enumerate(babelize(phrase, 'english', language)):
  File "/usr/local/lib/python2.7/dist-packages/nltk/misc/babelfish.py", line 126, in babelize
    phrase = translate(phrase, next, flip[next])
  File "/usr/local/lib/python2.7/dist-packages/nltk/misc/babelfish.py", line 106, in translate
    if not match: raise BabelfishChangedError("Can't recognize translated string.")
nltk.misc.babelfish.BabelfishChangedError: Can't recognize translated string.
Run Code Online (Sandbox Code Playgroud)

我已经导入了nltk.book;

from nltk.book import*
Run Code Online (Sandbox Code Playgroud)

*NLTK书籍的介绍性例子*

加载text1,...,text9和sent1,...,sent9

键入要查看的文本或句子的名称.

键入:'texts()'或'sents()'列出材料.

text1:Herman Melville的Moby Dick 1851

text2:Jane Austen 1811年的理智与情感

text3:创世记

text4:就职演说语料库

text5:聊天语料库

text6:Monty Python和圣杯

text7:华尔街日报

text8:Personals Corpus

text9:G周四的男人.K. 切斯特顿1908年

谁可以帮助我..我是python的新手,没有得到错误的确切...

Jel*_*ing 10

问题不在于您的代码.问题是,babelfish翻译服务不再运行,因此示例代码不再有效.

有关详细信息,访问https://github.com/nltk/nltk/issues/265