NLP Negex Taking Too Long

124 Views Asked by At

I'm currently trying to find entities that are negated.

I have the following code, but since my string is too long, it's taking forever to run.

Is there any way I can optimize this? I haven't found a good solution that's working.

nlp.add_pipe("negex",last=True)
doc = nlp(my string)
fmt_str = "{:<22}| {:<10}"
print(fmt_str.format("Entity", "Is negated"))
for entity in doc.ents:
    print(fmt_str.format(entity.text, entity._.negex))

Any help would be greatly appreciated.

Thank you!

0

There are 0 best solutions below