0
0
NLPml~20 mins

spaCy installation and models in NLP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
spaCy Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding spaCy Model Sizes

Which spaCy model is the smallest and fastest but provides less detailed linguistic features?

Aen_core_web_md
Ben_core_web_sm
Cen_core_web_lg
Den_core_web_trf
Attempts:
2 left
💡 Hint

Think about the naming convention where 'sm' stands for small.

Predict Output
intermediate
2:00remaining
Output of spaCy Model Loading Code

What will be the output of the following code snippet?

NLP
import spacy
nlp = spacy.load('en_core_web_sm')
doc = nlp('Apple is looking at buying U.K. startup for $1 billion')
print([(ent.text, ent.label_) for ent in doc.ents])
A[('Apple', 'ORG'), ('U.K.', 'GPE'), ('$1 billion', 'MONEY')]
B[('Apple', 'PERSON'), ('U.K.', 'ORG'), ('$1 billion', 'MONEY')]
C[('Apple', 'ORG'), ('U.K.', 'LOC'), ('$1 billion', 'MONEY')]
D[('Apple', 'ORG'), ('U.K.', 'GPE'), ('$1 billion', 'QUANTITY')]
Attempts:
2 left
💡 Hint

Look at common entity labels: ORG for organizations, GPE for geopolitical entities, MONEY for monetary values.

Model Choice
advanced
1:30remaining
Choosing the Best spaCy Model for Transformer-Based Accuracy

You want to use spaCy for a project that requires the highest accuracy using transformer models. Which model should you choose?

Aen_core_web_sm
Ben_core_web_md
Cen_core_web_lg
Den_core_web_trf
Attempts:
2 left
💡 Hint

Transformer models usually have 'trf' in their name.

Hyperparameter
advanced
1:30remaining
spaCy Pipeline Components Loading

When loading a spaCy model with spacy.load(), which parameter allows you to disable specific pipeline components to speed up processing?

Adisable=['parser', 'ner']
Bremove=['parser', 'ner']
Cskip=['parser', 'ner']
Dexclude=['parser', 'ner']
Attempts:
2 left
💡 Hint

Check spaCy documentation for the parameter name to disable components.

🔧 Debug
expert
2:00remaining
Error When Loading spaCy Model

What error will occur if you try to load a spaCy model that is not installed on your system using spacy.load('en_core_web_md')?

AValueError: Model name must be a string
BImportError: No module named 'en_core_web_md'
COSError: [E050] Can't find model 'en_core_web_md'. It doesn't seem to be a shortcut link, a Python package or a valid path.
DTypeError: spacy.load() missing 1 required positional argument
Attempts:
2 left
💡 Hint

Think about spaCy's error message when a model is missing.