February 2018
Beginner to intermediate
364 pages
10h 32m
English
The script to create the word cloud is in the 08/04_so_word_cloud.py file. This recipe continues on from the stack overflow recipes from chapter 7 to provide a visualization of the data.
from wordcloud import WordCloudfrom nltk.probability import FreqDist
freq_dist = FreqDist(cleaned)wordcloud = WordCloud(width=1200, height=800).generate_from_frequencies(freq_dist)
Now we just need to display the word cloud:
import matplotlib.pyplot as pltplt.imshow(wordcloud, interpolation='bilinear')plt.axis("off")plt.show()
And the resulting ...
Read now
Unlock full access