0
0
NLPml~10 mins

Stemming (Porter, Snowball) in NLP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a Porter stemmer object.

NLP
from nltk.stem import [1]
porter = [1]()
Drag options to blanks, or click blank then click option'
APorterStemmer
BSnowballStemmer
CWordNetLemmatizer
DLancasterStemmer
Attempts:
3 left
💡 Hint
Common Mistakes
Using SnowballStemmer instead of PorterStemmer
Trying to import WordNetLemmatizer which is for lemmatization, not stemming
2fill in blank
medium

Complete the code to stem the word 'running' using the Porter stemmer.

NLP
word = 'running'
stemmed_word = porter.[1](word)
print(stemmed_word)
Drag options to blanks, or click blank then click option'
Atokenize
Bstem
Clemmatize
Dparse
Attempts:
3 left
💡 Hint
Common Mistakes
Using lemmatize() method which is not available in PorterStemmer
Using tokenize() or parse() which are unrelated to stemming
3fill in blank
hard

Fix the error in the code to create a Snowball stemmer for English.

NLP
from nltk.stem import SnowballStemmer
stemmer = SnowballStemmer('[1]')
Drag options to blanks, or click blank then click option'
Agerman
Bspanish
Cfrench
Denglish
Attempts:
3 left
💡 Hint
Common Mistakes
Using capitalized language names like 'English'
Using a language different from the intended one
4fill in blank
hard

Fill both blanks to stem the word 'happiness' using SnowballStemmer for English.

NLP
from nltk.stem import [1]
stemmer = [1]('[2]')
print(stemmer.stem('happiness'))
Drag options to blanks, or click blank then click option'
ASnowballStemmer
BPorterStemmer
Cenglish
Dspanish
Attempts:
3 left
💡 Hint
Common Mistakes
Using PorterStemmer with a language argument (it does not take one)
Using 'spanish' instead of 'english' for the language
5fill in blank
hard

Fill all three blanks to create a dictionary of stemmed words from a list using PorterStemmer.

NLP
from nltk.stem import [1]
porter = [1]()
words = ['running', 'jumps', 'easily']
stemmed = {word: porter.[2](word) for word in [3]
print(stemmed)
Drag options to blanks, or click blank then click option'
APorterStemmer
Bstem
Cwords
DSnowballStemmer
Attempts:
3 left
💡 Hint
Common Mistakes
Using SnowballStemmer instead of PorterStemmer
Using lemmatize() instead of stem()
Using a variable name other than words in the loop