It should be back_text = self._get_translatedText(self._sendRequest(tran_text, tmp, src)) here. Otherwise, the tran_text is not used, which means the logic and result are wrong.
Besides, I recommend it be noticed that Baidu Translation API has QPS (requests per second) limit. If you are using standard service, then you can only submit 1 request per second. In the current version of this library, this kind of unexpected behavior is not caught, which may cause some trouble for users (at least it has been caused on me).
Thanks for this library which is useful!
https://github.com/hhhwwwuuu/BackTranslation/blob/d421867bf7a52ae278c2bfc2e7f1d33cd9e84b67/BackTranslation/translation_Baidu.py#L67
It should be
back_text = self._get_translatedText(self._sendRequest(tran_text, tmp, src))
here. Otherwise, thetran_text
is not used, which means the logic and result are wrong.Besides, I recommend it be noticed that Baidu Translation API has QPS (requests per second) limit. If you are using standard service, then you can only submit 1 request per second. In the current version of this library, this kind of unexpected behavior is not caught, which may cause some trouble for users (at least it has been caused on me).