BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Natural Language Processing (NLP) in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Initialize the PorterStemmer().
  • Use a list comprehension to stem each token from the clean_tokens list.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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)
Kodu Düzenle ve Çalıştır