简体   繁体   中英

Python googletrans output differs from the web version of Google Translate

I am trying to use python googletrans package, but it produces lower-quality translations than the web interface of Google Translate.

Here is my code:

from googletrans import Translator
translator = Translator()
text = 'Проверим, насколько качественным получается перевод, если пользоваться веб-интерфейсом.'
result = translator.translate(text, src='ru', dest='en')
print(result.text)

The output is: We check to see how well it turns out the translation, if you use the web interface.

The translation I obtain using the web interface is as follows: Let's check how high-quality the translation is if you use the web interface.

How can this difference be explained and is there anything I can do about it?

According to the docs, it's not actually using the official translate API:

  • The maximum character limit on a single text is 15k.
  • Due to limitations of the web version of google translate, this API does not guarantee that the library would work properly at all times. (so please use this library if you don't care about stability.)
  • If you want to use a stable API, I highly recommend you to use Google's official translate API.

https://py-googletrans.readthedocs.io/en/latest/

They link to the official API documentation here: https://cloud.google.com/translate/docs

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