Created
August 12, 2018 23:36
-
-
Save omarsar/9bf037f32ca66737deb73bcd63d2ecab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
image_file = read_file("1kHhmo4fj5PqhpH2x_hVY6uUDgf2_G0Tn") | |
# create mask | |
alice_mask = np.array(Image.open(image_file)) | |
# remove stopwords | |
stopwords = set(STOPWORDS) | |
stopwords.add("said") | |
# generate word cloud | |
wc = WordCloud(background_color="white", max_words=2000, mask=alice_mask, | |
stopwords=stopwords) | |
wc.generate(document) | |
# plot the word cloud | |
plt.figure(figsize=(8,6), dpi=120) | |
plt.imshow(wc, interpolation='bilinear') | |
plt.axis("off") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment