Challenge - 5 Problems
Lemmatization Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Lemmatization with POS Tag
What is the output of the following Python code using NLTK's WordNetLemmatizer when lemmatizing the word 'better' as an adjective?
NLP
from nltk.stem import WordNetLemmatizer lemmatizer = WordNetLemmatizer() result = lemmatizer.lemmatize('better', pos='a') print(result)
Attempts:
2 left
💡 Hint
Consider how lemmatization uses part of speech to find the base form.
✗ Incorrect
When lemmatizing 'better' as an adjective (pos='a'), the lemmatizer returns its base form 'good'. Without specifying pos, it would return 'better'.
🧠 Conceptual
intermediate1:30remaining
Purpose of Lemmatization in Text Processing
Which of the following best describes the main purpose of lemmatization in natural language processing?
Attempts:
2 left
💡 Hint
Think about how lemmatization differs from simple word cutting.
✗ Incorrect
Lemmatization reduces words to their base or dictionary form (lemma) by considering the word's meaning and part of speech, unlike stemming which may just cut off endings.
❓ Metrics
advanced2:00remaining
Evaluating Lemmatization Impact on Text Classification
You apply lemmatization to your training and test datasets before training a text classifier. Which metric is best to compare model performance before and after lemmatization?
Attempts:
2 left
💡 Hint
Focus on how well the model predicts unseen data.
✗ Incorrect
Accuracy on the test set measures how well the model generalizes to new data, showing if lemmatization improved understanding.
🔧 Debug
advanced1:30remaining
Identifying the Error in Lemmatization Code
What error will this code raise when run?
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
word = 'running'
result = lemmatizer.lemmatize(word)
print(result)
NLP
from nltk.stem import WordNetLemmatizer lemmatizer = WordNetLemmatizer() word = 'running' result = lemmatizer.lemmatize(word) print(result)
Attempts:
2 left
💡 Hint
Check the default behavior of lemmatize without pos argument.
✗ Incorrect
Without specifying pos, lemmatize treats the word as a noun, so 'running' stays 'running'. No error occurs.
❓ Model Choice
expert2:30remaining
Choosing the Best Lemmatization Approach for Ambiguous Words
You want to lemmatize words in a sentence where words can have multiple parts of speech (e.g., 'saw' as noun or verb). Which approach will give the most accurate lemmatization?
Attempts:
2 left
💡 Hint
Think about how context helps decide the correct base form.
✗ Incorrect
POS tagging before lemmatization helps identify the correct part of speech, so the lemmatizer can find the right base form for ambiguous words.