gpt4 book ai didi

python - babelize_shell() 在 NLTK 包中不起作用

转载 作者:太空狗 更新时间:2023-10-30 01:58:38 24 4
gpt4 key购买 nike

我正在使用 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 书籍的介绍性示例 ***

Loading text1, ..., text9 and sent1, ..., sent9

Type the name of the text or sentence to view it.

Type: 'texts()' or 'sents()' to list the materials.

text1: Moby Dick by Herman Melville 1851

text2: Sense and Sensibility by Jane Austen 1811

text3: The Book of Genesis

text4: Inaugural Address Corpus

text5: Chat Corpus

text6: Monty Python and the Holy Grail

text7: Wall Street Journal

text8: Personals Corpus

text9: The Man Who Was Thursday by G . K . Chesterton 1908

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

最佳答案

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

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

关于python - babelize_shell() 在 NLTK 包中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25215887/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com