index out of range while training spacy
Hi, I am getting an error at the GoldParse nlp = spacy.load('en_core_web_sm') train_data = [('2 ABC DEF XYZ',['U-ORDINAL','O','O','O']), ('DEF Two ABC XYZ',['O','U-ORDINAL','O','O'])]
optimizer = nlp.begin_training()
for itn in range(50):
random.shuffle(train_data)
for raw_text, entity_offsets in train_data:
doc = nlp.make_doc(raw_text)
nlp.tagger(doc)
gold = GoldParse(doc, entities=entity_offsets)
nlp.entity.update([doc], [gold], drop=0.5, sgd=optimizer)
Getting an error at the line GoldParse "list index out of range"
My actual training_data has around 180 items. Is there an issue with the structure of train_data? If the issue is with the text and corresponding entity annotation, then is there a better way to catch it before the GoldParse statement to see which of the item is causing issue?
- Operating System: Windows 64 bit
- Python Version Used: 3.6
- spaCy Version Used: 2.0.11
- Environment Information:
I think i got the issue, some of the text inside train_data is having space, as a result the number of tokens and annotations are not matching.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.