是否有用于将文本从一种人类语言翻译成另一种语言的Python模块?我打算使用Python脚本进行前后处理的文本.还可以使用哪些其他Python集成方法?
嗨,我正在学习使用NLTK的自然语言处理.我正在尝试实现本书的babelize_shell()示例.我正在做的是执行babelize_shell(),之后我输入我的字符串,接着是书中所述的德语,然后是run.
我得到的错误是:
Traceback (most recent call last):
File "<pyshell#148>", line 1, in <module>
babelize_shell()
File "C:\Python27\lib\site-packages\nltk\misc\babelfish.py", line 175, in babelize_shell
for count, new_phrase in enumerate(babelize(phrase, 'english', language)):
File "C:\Python27\lib\site-packages\nltk\misc\babelfish.py", line 126, in babelize
phrase = translate(phrase, next, flip[next])
File "C:\Python27\lib\site-packages\nltk\misc\babelfish.py", line 106, in translate
if not match: raise BabelfishChangedError("Can't recognize translated string.")
BabelfishChangedError: Can't recognize translated string.
Run Code Online (Sandbox Code Playgroud)
这是一个示例会话:
>>> babelize_shell()
NLTK Babelizer: type 'help' for a list of commands.
Babel> how long before the next flight to Alice Springs?
Babel> …Run Code Online (Sandbox Code Playgroud)