Skip to content

Instantly share code, notes, and snippets.

@YHaruoka
Last active May 25, 2022 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YHaruoka/a3f863d16c7d57f7fc63d0f8564bfcb7 to your computer and use it in GitHub Desktop.
Save YHaruoka/a3f863d16c7d57f7fc63d0f8564bfcb7 to your computer and use it in GitHub Desktop.
from wordcloud import WordCloud
import matplotlib.pyplot as plt
stop_words = ["based", "using", "via", "for", "with", "on", "in", "of", "a", "and", "the", "to", "from", "by", "method", "non", "an", "toward","towards"]
text = open("test.txt",encoding='utf-8').read()
wordcloud = WordCloud(width=1920, height=1080, max_words=50,background_color="black", stopwords=stop_words, max_font_size=250).generate(text)
wordcloud.to_file("word_cloud_result.png")
plt.imshow(wordcloud)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment