Step 1: Word cloud and feature creation
You will work with a sample of the reviews
dataset throughout this exercise. It contains the review
and score
columns. Feel free to explore it in the IPython Shell.
In the first step, you will build a word cloud using only positive reviews. The string positive_reviews
has been created for you by concatenating the top 100 positive reviews.
In the second step, you will create a new feature for the length of each review and add that new feature to the dataset.
All the functions needed to plot a word cloud have been imported for you, as well as the word_tokenize
function from the nltk
module.
This exercise is part of the course
Sentiment Analysis in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create and generate a word cloud image
cloud_positives = ____(background_color='white').____(positive_reviews)
# Display the generated wordcloud image
plt.___(cloud_positives, interpolation='bilinear')
plt.axis("off")
# Don't forget to show the final image
plt.show()