I am writing a code to train custom entities in Spacy's NER engine. I am stuck in understanding small part of code from an online tutorial. Here's a link to the tutorial. The following code is line number 12-15. I am new to python so stuck understanding this part of the code;
# add labels for _, annotations in TRAIN_DATA: for ent in annotations.get('entities'): ner.add_label(ent)
Apparently, this for loop is adding custom labels to the NER. M questions are;
- What is an 'annotation'? (I googled for 'spacy annotation' but couldn't find the answer)
- Why are there two variables to the left of 'in', ('_' and 'annotation')?
- What does ent return? What's at pos 2?