Created
August 11, 2019 22:45
-
-
Save mlai-demo/204c1d2e3c58d9244fd4ad6cee9534c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from wordcloud import WordCloud | |
import matplotlib.pyplot as plt | |
from os import path | |
d = path.dirname(__file__) if "__file__" in locals() else os.getcwd() | |
text_standard = open(fpath + '/Plutarch_tokens.txt', 'rt').read() | |
wc = WordCloud(stopwords=stop_words, | |
max_font_size=200, | |
width=2500, | |
height=2000, | |
max_words=4000, | |
random_state=44, | |
).generate(text_standard) | |
wc.to_file(path.join(d, "wc.png")) #comment out if no need to store the png | |
fig = plt.figure().set_size_inches(18, 18) | |
plt.imshow(wc, interpolation="bilinear") | |
plt.axis("off") | |
plt.title("Plutarch's Lives", fontsize= 20) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment