首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PyDictionary翻译()返回无效字无

PyDictionary翻译()返回无效字无
EN

Stack Overflow用户
提问于 2016-05-03 16:53:52
回答 1查看 2.5K关注 0票数 1

我编写了一个名为translate.py的脚本:

代码语言:javascript
复制
from PyDictionary import PyDictionary
dictionary=PyDictionary()
print (dictionary.meaning("indentation"))
print (dictionary.synonym("Life"))
print (dictionary.antonym("Life"))
print (dictionary.translate("Hello",'es'))

我收到正确的输出,除了

代码语言:javascript
复制
  print (dictionary.translate("Hello",'es')):

下面是我的命令行输出:

代码语言:javascript
复制
macintosh-3:reorder chibb9$ python translate.py 
{u'Noun': ['a concave cut into a surface or edge (as in a coastline', 'the    formation of small pits in a surface as a consequence of corrosion', 'the space left between the margin and the start of an indented line', 'the act of cutting into an edge with toothlike notches or angular incisions']}
[u'heart', u'growth', u'soul', u'activity', u'get-up-and-go']
[u'abstract', u'idleness', u'inactivity', u'laziness', u'lethargy']
Invalid Word
None

我尝试了使用不同语言代码的命令dictionary.translate( "[word]", "[language_code]")许多不同的单词,并且我一直为每一对得到这个输出:

代码语言:javascript
复制
Invalid Word
None

我还尝试使用PyDictionary github (http://github.com/geekpradd/PyDictionary)上列出的使用web服务。

但是我被定向到一个页面(图片附件,图片链接名称中的网页链接):

内部服务器错误

服务器遇到内部错误,无法完成请求。要么服务器重载,要么应用程序中出现错误。

http://pydictionary-geekpradd.rhcloud.com/api/translate/[code]/[word]

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-03 17:01:21

PyDictionary使用Google翻译进行翻译,并且正如它用来访问Google翻译的模块的PyPI页面上所指出的那样,谷歌改变了一些东西来阻止这种情况。PyDictionary翻译将不再起作用。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37009972

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档