Hi,
Any one has the same issue when using match patterns for data annotation? The patterns works in spacy. But when using prodigy, I got below errors. I tried several patterns and got same errors. Could any one help? thank you.
TypeError: list indices must be integers or slices, not str
here are the spacy code which can extract word groups:
import spacy
from spacy.pipeline import EntityRuler
nlp = spacy.load("en_core_web_sm", disable=['ner'])
Entity for np
np_pattern = [{'TAG': {'IN': ['NN', 'NNP', 'NNSS', 'NNPS', 'NNS', 'JJ']}, "OP": "+"}]
patterns_np = [{"label":"NounPhrase", "pattern":np_pattern}]
ruler_np = EntityRuler(nlp, overwrite_ents=True)
ruler_np.add_patterns(patterns_np)
ruler_np.name = 'ruler_np'
nlp.add_pipe(ruler_np)
text2 = "Overview of Treatment-Emergent Hepatic Disorder Events"
Entity Ruler
doc = nlp(text2)
for ent in doc.ents:
print(ent.text)
print(ent.label_)