Word Cloud on movie reviews
You have been working with the movie reviews dataset. You have explored the distribution of the reviews and have seen how long the longest and the shortest reviews are. But what do positive and negative reviews talk about?
In this exercise, you will practice building a word cloud of the top 100 positive reviews.
What are the words that pop up? Do they make sense to you?
The string descriptions
has been created for you by concatenating the descriptions of the top 100 positive reviews. A movie-specific set of stopwords (very frequent words, such as the, a/an, and, which will not be very informative and we'd like to exclude from the graph) is available as my_stopwords
. Recall that the interpolation
argument makes the word cloud appear more smoothly.
This exercise is part of the course
Sentiment Analysis in Python
Exercise instructions
- Import the wordcloud function from the respective package.
- Apply the word cloud function to the
descriptions
string. Set the background color as 'white', and change thestopwords
argument. - Create a wordcloud image.
- Finally, do not forget to display the image.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the word cloud function
____
# Create and generate a word cloud image
my_cloud = ____(____='white', ____=my_stopwords).____(descriptions)
# Display the generated wordcloud image
plt.____(____, interpolation='bilinear')
plt.axis("off")
# Don't forget to show the final image
____