Complete the code to import the library needed for Named Entity Recognition (NER) training.
import [1]
We use spacy for training custom Named Entity Recognition models.
Complete the code to load a blank English model for NER training.
nlp = spacy.blank('[1]')
We use 'en' to load a blank English model for training.
Fix the error in adding the NER pipeline component to the model.
ner = nlp.add_pipe('[1]')
The pipeline component for Named Entity Recognition is called 'ner'.
Fill both blanks to add a new entity label and prepare the optimizer.
ner.add_label('[1]') optimizer = nlp.[2]()
We add the entity label 'PERSON' and start training with begin_training().
Fill all three blanks to update the model with training data and print the loss.
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])
We use annotations for labels, optimizer for training, and losses to track errors.
