0
0
NLPml~20 mins

What NLP actually does - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
NLP Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding NLP Tasks
Which of the following best describes a primary task of Natural Language Processing (NLP)?
AConverting images into text descriptions
BTranslating human language into machine-readable data for understanding and response
COptimizing hardware performance for faster computing
DStoring large amounts of data efficiently
Attempts:
2 left
💡 Hint
Think about what NLP does with human language.
Predict Output
intermediate
2: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)
A['Hello world', 'NLP is fun']
B['Hello world!', 'NLP is fun.']
C['Hello', 'world', '!', 'NLP', 'is', 'fun', '.']
D['Hello', 'world!', 'NLP', 'is', 'fun.']
Attempts:
2 left
💡 Hint
Tokenization splits text into words and punctuation separately.
Model Choice
advanced
2: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?
AA convolutional neural network (CNN) trained on labeled text data
BA k-means clustering model for grouping text
CA linear regression model predicting numerical values
DA decision tree model for image classification
Attempts:
2 left
💡 Hint
Sentiment analysis needs a model that understands text and classifies feelings.
Metrics
advanced
2: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?
AAccuracy
BRecall
CPrecision
DF1 Score
Attempts:
2 left
💡 Hint
Think about the metric that measures correct predictions out of all predictions.
🔧 Debug
expert
2: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)
ATypeError because 'ent.label_' is not a string
BPrints all entities correctly without error
CSyntaxError due to missing colon in for loop
DAttributeError because 'Doc' object has no attribute 'entities'
Attempts:
2 left
💡 Hint
Check spaCy's documentation for the correct attribute name to access entities.