-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I get this to work? #49
Comments
Hi - there could be two issues here:
You can create and entity ruler . See the example below where football is negated by cannot which is a preceding term in the "en" termset. If you want to change termsets, see this example.
|
Thanks so much for your help! This makes sense. Apologies for the delay in getting back to you. Although, if I replace 'football' with 'hockey' in the doc - nothing is returned - am I missing something else? Huge apologies, I'm very new to this and learning. |
So for the example code I pasted above, it's looking specifically for 'ice hockey' not just 'hockey'. If you changed the patterns to remove 'ice' as shown below then it would work.
|
Thanks @jenojp, this is really helpful! |
I think I'm missing something here and can't seem to resolve it.
The code works with the example texts provided in much of the documentation (e.g. "She does not like Steve Jobs but likes Apple products."), and the term 'cannot' appears in the termset - how can I identify these simple negations? Please note the print is indented in the original code.
Here's my code:
pip install negspacy
import spacy
from negspacy.negation import Negex
nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("negex", config={"ent_types":["PERSON","ORG"]})
ts = termset("en")
nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("negex", config={"ent_types":["PERSON","ORG"]})
doc = nlp("Men cannot play football.")
for e in doc.ents:
print(e.text,` e._.negex)
The text was updated successfully, but these errors were encountered: