Stemming
Now that you've cleaned the review text and removed stop words and punctuation, you're ready to normalize the remaining words using stemming to reduce words to their root form. This helps group similar words together, making your analysis more consistent and efficient.
The PorterStemmer class has been provided, along with a list of clean_tokens.
Questo esercizio fa parte del corso
Natural Language Processing (NLP) in Python
Istruzioni dell'esercizio
- Initialize the
PorterStemmer(). - Use a list comprehension to stem each token from the
clean_tokenslist.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
clean_tokens = ['flying', 'lot', 'lately', 'flights', 'keep', 'getting', 'delayed', 'honestly', 'traveling', 'work', 'gets', 'exhausting', 'endless', 'delays', 'every', 'travel', 'teaches', 'something', 'new']
# Create stemmer
stemmer = ____()
# Stem each token
stemmed_tokens = [____.____(____) for ____ in clean_tokens]
print(stemmed_tokens)