'Experiencing 'HTTP Error 400: Bad Request' on Google's Perspective API when passing a dataset in Python
I've been trying to use Google's Perspective API to calculate Toxicity scores for tweet datasets, however, whenever I pass the dataframe, I keep getting the error 'HTTP Error 400: Bad Request'. Here is part of the code I have:
def scores(text):
result = p.score(text, tests=["TOXICITY"])
df.loc[index,'Toxicity']=result["TOXICITY"]
for index, row in df.iterrows():
scores(row["text"])
if index%10==0:
time.sleep(10)
I've tried to use a few datasets each of 100 tweets. Only 1 successfully created the Toxicity scores column. What can be done?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
