0
0
NLPml~10 mins

Lemmatization 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 import the WordNetLemmatizer from nltk.

NLP
from nltk.stem import [1]
Drag options to blanks, or click blank then click option'
AWordNetLemmatizer
BSnowballStemmer
CPorterStemmer
DLancasterStemmer
Attempts:
3 left
💡 Hint
Common Mistakes
Importing a stemmer class instead of a lemmatizer.
Misspelling the class name.
2fill in blank
medium

Complete the code to create a lemmatizer object.

NLP
lemmatizer = [1]()
Drag options to blanks, or click blank then click option'
AWordNetLemmatizer
BLemmatizer
CTokenizer
DStemmer
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to instantiate a class that does not exist.
Using stemmer classes instead.
3fill in blank
hard

Fix the error in the code to lemmatize the word 'running'.

NLP
lemma = lemmatizer.[1]('running')
Drag options to blanks, or click blank then click option'
Atokenize
Bstem
Cparse
Dlemmatize
Attempts:
3 left
💡 Hint
Common Mistakes
Using stem() which is for stemming, not lemmatization.
Using tokenize() which splits text, not lemmatizes.
4fill in blank
hard

Fill both blanks to lemmatize the word 'better' as an adjective.

NLP
lemma = lemmatizer.[1]('better', pos=[2])
Drag options to blanks, or click blank then click option'
Alemmatize
B'v'
C'a'
D'n'
Attempts:
3 left
💡 Hint
Common Mistakes
Not specifying the part of speech, so 'better' returns 'better' instead of 'good'.
Using pos='v' (verb) or pos='n' (noun) incorrectly.
5fill in blank
hard

Fill all three blanks to create a dictionary of words and their lemmas for nouns only.

NLP
words = ['cars', 'geese', 'mice']
lemmas = {word: lemmatizer.[1](word, pos=[2]) for word in words if word.endswith([3])}
Drag options to blanks, or click blank then click option'
Alemmatize
B'n'
C's'
D'ing'
Attempts:
3 left
💡 Hint
Common Mistakes
Not specifying pos='n' so lemmatization defaults to noun but may be ambiguous.
Filtering with wrong suffix like 'ing' which is for verbs.