【问题标题】:Can't translate with babelfish不能用 babelfish 翻译
【发布时间】:2014-09-27 18:17:26
【问题描述】:

所以我正在尝试使用 nltk 和 babelfish 学习机器翻译,但是每当我尝试使用 babelfish 方法时,我都会不断收到这些错误:

>>> import yahoo
>>> import nltk
>>> from nltk.misc import babelfish
>>> babelfish.translate('cookbook', 'english', 'spanish')
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/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.
>>> for text in babelfish.babelize('cookbook', 'english', 'spanish'):
...   print text
... 
cookbook
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/nltk/misc/babelfish.py", line 126, in babelize
phrase = translate(phrase, next, flip[next])
File "/usr/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.

我在这里做错了什么?

【问题讨论】:

    标签: python nlp nltk yahoo-api machine-translation


    【解决方案1】:

    代码没有问题,只是 babelfish API 不再可用,这使得 babelfish 的 NLTK API 无效 =(

    它也从最新版本的 NLTK 中删除,见 https://github.com/nltk/nltk/issues/265

    【讨论】:

      猜你喜欢
      • 2012-11-25
      • 2016-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-03
      • 2021-05-19
      相关资源
      最近更新 更多