def generate_word_cloud(col_name, min_score=0.5):
text_list = df_train.loc[df_train[col_name] > min_score, "comment_text"].tolist()
texts = " ".join(text_list).lower()
wc = WordCloud(
max_font_size=100,
max_words=100,
background_color="white",
stopwords=stop_words
).generate(texts)
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
ax.set_title(f"{col_name}", fontsize=20)
ax.imshow(wc, interpolation="bilinear")
ax.axis("off")
plt.show()
generate_word_cloud("target", min_score=0.7) # 텍스트가 많아서 score 조절
generate_word_cloud("severe_toxicity")
generate_word_cloud("obscene")
generate_word_cloud("threat")
generate_word_cloud("insult")
generate_word_cloud("identity_attack")
generate_word_cloud("sexual_explicit")