I wrote small script in python to translate words from English to Russian language. It uses the Microsoft-Translator-Python-API for connection to Microsoft Translator API. However, there is a problem of delay – it takes up to three seconds to call API and get translation.
Does anybody know the way to make it work faster if it’s possible?
I’ll put piece of my code, just to show what am I doing here:
translator = Translator('My-User-Id',
'My-Client-Secret')
current_word = subprocess.check_output(["xsel", "-o"])
translation = translator.translate(current_word, "ru")
Interestingly enough, you can actually do this:
and get an immediate response a bunch of times before it slows down (6-7 times with immediate response before it slows down). I haven’t used Azure that much so I’m not sure how their rate limiting works, but I’m sure you can pay to up that rate.
(note: I grabbed bits of the above code right out of that microsoft library. just wanted to see what the logic alone behaves like)