您曾经能够用来nltk.misc.babelfish翻译东西,但雅虎Babelfish API却失败了.有没有一种简单的方法可以说,这样做?
>>> import translate
>>> translate('carpe diem', 'latin', 'english')
'seize the day'
Run Code Online (Sandbox Code Playgroud) 几个月前,我使用Python的goslate软件包将一堆法语文本翻译成英文.但是,当我今天早上尝试这样做时,该服务返回了一个错误:
import goslate
gs = goslate.Goslate()
print gs.translate('hello world', 'de')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python27\lib\site-packages\goslate.py", line 389, in translate
return _unwrapper_single_element(self._translate_single_text(text, target_language, source_language))
File "c:\Python27\lib\site-packages\goslate.py", line 317, in _translate_single_text
results = list(self._execute(make_task(i) for i in split_text(text)))
File "c:\Python27\lib\site-packages\goslate.py", line 200, in _execute
yield each()
File "c:\Python27\lib\site-packages\goslate.py", line 315, in <lambda>
return lambda: self._basic_translate(text, target_language, source_lauguage)[0]
File "c:\Python27\lib\site-packages\goslate.py", line 241, in _basic_translate
response_content = self._open_url(url)
File "c:\Python27\lib\site-packages\goslate.py", line 178, in _open_url …Run Code Online (Sandbox Code Playgroud)