menelik3
menelik3

Reputation: 41

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?

Upvotes: 4

Views: 1952

Answers (1)

yoursweater
yoursweater

Reputation: 2041

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

Upvotes: 1

Related Questions