Errow using googletranslate package in Python: Expecting value: line 1 column 1 (char 0)

倖福魔咒の 提交于 2020-04-18 06:13:40

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/61042272/errow-using-googletranslate-package-in-python-expecting-value-line-1-column-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!