title: Python Google Translate API error : How to translate a large amount of data
body: <h1>My problem</h1>
  <p>I would like to use a kind of data-augmentation method for NLP consisting of back-translating dataset.</p>
  <p>Basically, I have a large dataset (<a href="https://nlp.stanford.edu/projects/snli/" rel="noreferrer">SNLI</a>), consisting of 1 100 000 english sentences. What I need to do is : translate these sentences in a language, and translate it back to English.</p>
  <p>I may have to do this for several language. So I have <strong>a lot</strong> of translations to do.</p>
  <p><em>I need a free solution.</em></p>
  <hr />
  <h1>What I did so far</h1>
  <p>I tried several python module for translation, but due to recent changes in Google Translate API, most of them do not work. <a href="https://pypi.org/project/googletrans/" rel="noreferrer">googletrans</a> seems to work if we apply this <a href="https://stackoverflow.com/a/52456197/9494790">solution</a>.</p>
  <p>However, it is not working for big dataset. There is a limit of 15K characters by Google (as pointed out by <a href="https://stackoverflow.com/questions/49497391/googletrans-api-error-expecting-value-line-1-column-1-char-0">this</a>, <a href="https://stackoverflow.com/questions/48021371/jsondecodeerror-using-google-translate-api-with-python3">this</a> and <a href="https://stackoverflow.com/questions/48957624/python-google-translate-api-error">this</a>). The first link show a supposed work-around.</p>
  <hr />
  <h1>Where I am blocked</h1>
  <p>Even if I apply the <a href="https://stackoverflow.com/a/49497469/9494790">work-around</a> (initializing the Translator every iteration), it is not working, and I got the following error :</p>
  <pre><code>json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  </code></pre>
  <p>I tried using proxies and others Google translate URLs :</p>
  <pre><code>URLS = ['translate.google.com', 'translate.google.co.kr', 'translate.google.ac', 'translate.google.ad', 'translate.google.ae', ...]
  
  proxies = {    'http': '1.243.64.63:48730',   'https': '59.11.98.253:42645', }
  
  t = Translator(service_urls=URLS, proxies=proxies)
  </code></pre>
  <p>But it's not changing anything.</p>
  <hr />
  <h1>Note</h1>
  <p>My problem might come from the fact that I am using multi-threading : 100 workers for translating the whole dataset. If they work in parallel, maybe they use more than 15k characters together.</p>
  <p>But I should use multi-threading. If I don't, it will take several weeks to translate the whole dataset...</p>
  <hr />
  <h1>My question</h1>
  <p><strong>How do I fix this error so I can translate all sentences ?</strong></p>
  <p>If it's not possible, <strong>is there any free alternative, to get machine translation in Python (not mandatory to use Google Translate), for such a big dataset ?</strong></p>