When I use this code, I can generate negex as seperate column
doc=nlp_negex(d)
labels=["ENTITY", "FAMILY"]
dftest = pd.DataFrame(columns=["ent","label", "negex", "sent"])
attrs = ["text", "label", "sent"]
for e in doc.ents:
if e.label_ in labels:
df_test = dftest.append({'ent': e.text,'label': e.label, 'negex': e._.negex, "sent":str(e.sent) }, ignore_index=True)
But, when I use the following code
doc=nlpnegex(d)
labels=['ENTITY', 'FAMILY']
attrs = ["text", "label", "sent", "..negex"]
data = [[str(getattr(ent, attr)) for attr in attrs] for ent in doc.ents if ent.label in labels]
df2 = pd.DataFrame(data, columns=attrs)`
I am getting following error
`AttributeError: 'spacy.tokens.span.Span' object has no attribute '._.negex'
When I use this code, I can generate negex as seperate column doc=nlp_negex(d) labels=["ENTITY", "FAMILY"] dftest = pd.DataFrame(columns=["ent","label", "negex", "sent"]) attrs = ["text", "label", "sent"] for e in doc.ents: if e.label_ in labels: df_test = dftest.append({'ent': e.text,'label': e.label, 'negex': e._.negex, "sent":str(e.sent) }, ignore_index=True)
But, when I use the following code
doc=nlpnegex(d) labels=['ENTITY', 'FAMILY'] attrs = ["text", "label", "sent", "..negex"] data = [[str(getattr(ent, attr)) for attr in attrs] for ent in doc.ents if ent.label in labels] df2 = pd.DataFrame(data, columns=attrs)`
I am getting following error `AttributeError: 'spacy.tokens.span.Span' object has no attribute '._.negex'
How can I access negex as a registered extension
Thank you