【问题标题】:babelize_shell() not working in NLTK packagebabelize_shell() 在 NLTK 包中不起作用
【发布时间】:2014-08-09 06:28:07
【问题描述】:

我正在使用 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.

如前所述,我已经导入了 nltk.book:

from nltk.book import*

*** NLTK 书籍的介绍性示例 ***

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

键入文本或句子的名称以查看它。

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

text1:赫尔曼·梅尔维尔 1851 年的《白鲸记》

text2:简·奥斯汀 1811 年的《理智与情感》

text3:创世记

text4:就职演说语料库

text5:聊天语料库

text6:巨蟒与圣杯

text7:华尔街日报

text8:交友语料库

text9:G 的那个星期四的人。克。切斯特顿 1908 年

谁能帮帮我。我是 Python 新手,不知道错误到底是什么。

【问题讨论】:

    标签: python nltk


    【解决方案1】:

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

    更多详情https://github.com/nltk/nltk/issues/265

    【讨论】:

      猜你喜欢
      • 2015-12-10
      • 1970-01-01
      • 1970-01-01
      • 2016-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多