Challenge - 5 Problems
NLP Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding NLP Tasks
Which of the following best describes a primary task of Natural Language Processing (NLP)?
Attempts:
2 left
💡 Hint
Think about what NLP does with human language.
✗ Incorrect
NLP focuses on making machines understand and work with human language by converting it into a form they can process.
❓ Predict Output
intermediate2:00remaining
Output of Tokenization in NLP
What is the output of this Python code using NLTK for tokenization?
NLP
import nltk nltk.download('punkt') from nltk.tokenize import word_tokenize text = "Hello world! NLP is fun." tokens = word_tokenize(text) print(tokens)
Attempts:
2 left
💡 Hint
Tokenization splits text into words and punctuation separately.
✗ Incorrect
The word_tokenize function splits the sentence into words and punctuation marks as separate tokens.
❓ Model Choice
advanced2:00remaining
Choosing the Right NLP Model for Sentiment Analysis
Which model is best suited for analyzing the sentiment (positive or negative feeling) of movie reviews?
Attempts:
2 left
💡 Hint
Sentiment analysis needs a model that understands text and classifies feelings.
✗ Incorrect
CNNs can learn patterns in text sequences and are effective for sentiment classification tasks.
❓ Metrics
advanced2:00remaining
Evaluating NLP Classification Accuracy
You trained an NLP model to classify emails as spam or not spam. Which metric best tells you how many emails were correctly classified overall?
Attempts:
2 left
💡 Hint
Think about the metric that measures correct predictions out of all predictions.
✗ Incorrect
Accuracy measures the proportion of total correct predictions (both spam and not spam) out of all emails.
🔧 Debug
expert2:00remaining
Debugging a Named Entity Recognition (NER) Model Output
Given this Python code snippet using spaCy for NER, what error or issue will occur when running it?
NLP
import spacy nlp = spacy.load('en_core_web_sm') doc = nlp('Apple is looking at buying U.K. startup for $1 billion') for ent in doc.ents: print(ent.text, ent.label_) # Later code print(doc.entities)
Attempts:
2 left
💡 Hint
Check spaCy's documentation for the correct attribute name to access entities.
✗ Incorrect
The correct attribute is 'ents', not 'entities'. Using 'doc.entities' causes an AttributeError.