Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the library needed for Named Entity Recognition (NER) training.
NLP
import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated libraries like numpy or pandas.
Forgetting to import the NLP library before training.
✗ Incorrect
We use spacy for training custom Named Entity Recognition models.
2fill in blank
mediumComplete the code to load a blank English model for NER training.
NLP
nlp = spacy.blank('[1]')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using other language codes like 'fr' or 'de' when training English NER.
Passing full language names instead of codes.
✗ Incorrect
We use 'en' to load a blank English model for training.
3fill in blank
hardFix the error in adding the NER pipeline component to the model.
NLP
ner = nlp.add_pipe('[1]')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated pipeline components like 'textcat' or 'parser'.
Misspelling the component name.
✗ Incorrect
The pipeline component for Named Entity Recognition is called 'ner'.
4fill in blank
hardFill both blanks to add a new entity label and prepare the optimizer.
NLP
ner.add_label('[1]') optimizer = nlp.[2]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or unrelated strings as labels.
Calling a non-existent method like 'train()' instead of 'begin_training()'.
✗ Incorrect
We add the entity label 'PERSON' and start training with begin_training().
5fill in blank
hardFill all three blanks to update the model with training data and print the loss.
NLP
for text, annotations in TRAIN_DATA: doc = nlp.make_doc(text) example = spacy.training.Example.from_dict(doc, [1]) nlp.update([example], sgd=[2], losses=[3])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the wrong variable for annotations or optimizer.
Not tracking losses correctly.
✗ Incorrect
We use annotations for labels, optimizer for training, and losses to track errors.