简体   繁体   中英

PyDictionary translate() returns Invalid Word None

I made the following script called translate.py:

from PyDictionary import PyDictionary
dictionary=PyDictionary()
print (dictionary.meaning("indentation"))
print (dictionary.synonym("Life"))
print (dictionary.antonym("Life"))
print (dictionary.translate("Hello",'es'))

And I recieve the correct output for everything except

  print (dictionary.translate("Hello",'es')):

Here is my command line output:

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

I have tried the command dictionary.translate( "[word]", "[language_code]") many different words with different language codes and I keep getting this output for every pair:

Invalid Word
None

I have also tried using the usage web service listed on the PyDictionary github ( http://github.com/geekpradd/PyDictionary )

But I get directed to a page that reads (picture attached, web link in image link name):

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

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

PyDictionary uses Google Translate for translations, and as noted on the PyPI page of the module it uses to access Google Translate, Google changed things to stop this. PyDictionary translation will not work any more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM