<jupyter_start><jupyter_text>Filter Non-English TweetsHere, we remove tweets from our sample that aren't in English.We should have done this in the previous step but didn't, so we rely on TextBlob here.<jupyter_code>%matplotlib inline
import pandas as pd
import json

import matplotlib.pyplot as plt
from textblob import TextBlob
tweet_list = []

with open("full_diverse_sample.json", "r") as in_file:
    tweet_list = json.load(in_file)
x = TextBlob(tweet_list[0])
x.detect_language()
eng_tweets = list(filter(lambda x: TextBlob(x).detect_language() == "en", tweet_list))

len(eng_tweets)
with open("misogyny_en_samples_to_label.json", "w") as out_file:
    json.dump(eng_tweets, out_file)<jupyter_output><empty_output>