Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to install spaCy using pip.
NLP
pip [1] spacy Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pip update spacy' which is not the correct command to install.
Using 'pip remove spacy' which uninstalls the package.
✗ Incorrect
To install spaCy, you use the command pip install spacy.
2fill in blank
mediumComplete the code to download the English small model for spaCy.
NLP
python -m spacy [1] en_core_web_sm Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'download' for spaCy models.
Trying to use pip to install the model directly.
✗ Incorrect
To get a spaCy model, you run python -m spacy download en_core_web_sm.
3fill in blank
hardFix the error in the code to load the spaCy English model.
NLP
import spacy nlp = spacy.[1]('en_core_web_sm')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'download' or 'install' instead of 'load' in code.
Trying to run the model as a function.
✗ Incorrect
To use a spaCy model in code, you call spacy.load() with the model name.
4fill in blank
hardFill both blanks to create a spaCy pipeline and process text.
NLP
import spacy nlp = spacy.[1]('en_core_web_sm') doc = nlp([2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'download' instead of 'load' to get the model.
Passing a variable name instead of a string to the model.
✗ Incorrect
First, load the model with spacy.load(). Then pass a string like 'Hello world!' to the model to process text.
5fill in blank
hardFill all three blanks to extract tokens from text using spaCy.
NLP
import spacy nlp = spacy.[1]('en_core_web_sm') doc = nlp([2]) tokens = [token.[3] for token in doc]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'download' instead of 'load'.
Passing a variable name instead of a string.
Using 'token' instead of 'token.text' to get token strings.
✗ Incorrect
Load the model with load, pass a string to process, and get token text with token.text.