Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Sentiment Analysis in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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()
Code bewerken en uitvoeren