jenojp / negspacy

spaCy pipeline object for negating concepts in text
MIT License
274 stars 36 forks source link

When running example it returns "Steve Jobs False" #30

Closed ThomasBurgess2000 closed 3 years ago

ThomasBurgess2000 commented 3 years ago

Describe the bug When I run this example code:

import spacy
from negspacy.negation import Negex

nlp = spacy.load("en_core_web_sm")
negex = Negex(nlp, ent_types=["PERSON','ORG"])
nlp.add_pipe(negex, last=True)

doc = nlp("She does not like Steve Jobs but likes Apple products.")
for e in doc.ents:
    print(e.text, e._.negex)

It outputs: Steve Jobs False Apple False

Expected behavior Steve Jobs True

Desktop (please complete the following information):

jenojp commented 3 years ago

Hi @ThomasBurgess2000 - look at the mixing of single and double quotes in line 5 of your example. I think that's what's causing the issue.

ThomasBurgess2000 commented 3 years ago

That is the issue, thank you! However, I copied the code from here so you might want to update it: https://spacy.io/universe/project/negspacy

jenojp commented 3 years ago

Oh whoops - thanks for spotting that, I just double checked the readme but didn't think of there!

jenojp commented 3 years ago

fixed on spacy webpage https://github.com/explosion/spaCy/pull/6578