0

I have extracted the tweets from twitter and now trying to convert the text to English. It should detect the source language itself and convert to English.

This is the code i'm using:

from googletrans import Translator

translator = Translator()

tweet['English']= tweet['text_clean'].apply(translator.translate,dest='en').apply(getattr, args=('text',))

It was working initially but not anymore. Tried closing the jupyter notebook and restarting it again. It gives the same error even for processing 1 record:

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Any work-around?

I have already read posts and questions here on stackoverflow regarding this and tried the following:

1) Clean Text: Removed URL, smileys, blank rows, punctuation and etc.

2) Processed data in batches using chunk in order to deal with Google Translate API limit point.

WaLid LamRaoui
  • 2,305
  • 2
  • 15
  • 33
  • Probably related: https://stackoverflow.com/questions/61042396/googletrans-suddenly-stopped-working-and-giving-error. Seems there may be a problem with the API right now. – dspencer Apr 05 '20 at 13:00

1 Answers1

0

It's working fine now, seems to be a API issue yesterday.

Maryam
  • 41
  • 1
  • 2
  • 9