Commit 13ee3c86 authored by Andreas Mueller's avatar Andreas Mueller Committed by GitHub
Browse files

Merge pull request #130 from terrycojones/stopwords

Copy STOPWORDS and add to it, then pass it (instead of passing None).
parents d93c3100 30f4269e
...@@ -34,7 +34,7 @@ text = text.replace("HAN", "Han") ...@@ -34,7 +34,7 @@ text = text.replace("HAN", "Han")
text = text.replace("LUKE'S", "Luke") text = text.replace("LUKE'S", "Luke")
# adding movie script specific stopwords # adding movie script specific stopwords
stopwords = STOPWORDS.copy() stopwords = set(STOPWORDS)
stopwords.add("int") stopwords.add("int")
stopwords.add("ext") stopwords.add("ext")
......
...@@ -22,8 +22,11 @@ text = open(path.join(d, 'alice.txt')).read() ...@@ -22,8 +22,11 @@ text = open(path.join(d, 'alice.txt')).read()
# http://www.stencilry.org/stencils/movies/alice%20in%20wonderland/255fk.jpg # http://www.stencilry.org/stencils/movies/alice%20in%20wonderland/255fk.jpg
alice_mask = np.array(Image.open(path.join(d, "alice_mask.png"))) alice_mask = np.array(Image.open(path.join(d, "alice_mask.png")))
stopwords = set(STOPWORDS)
stopwords.add("said")
wc = WordCloud(background_color="white", max_words=2000, mask=alice_mask, wc = WordCloud(background_color="white", max_words=2000, mask=alice_mask,
stopwords=STOPWORDS.add("said")) stopwords=stopwords)
# generate word cloud # generate word cloud
wc.generate(text) wc.generate(text)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment