Closed madhurkgp closed 4 years ago
it would be beneficial if we can add custom patterns in the phrasematcher,
Well the issue isn't with the negation part of your pipeline here. In your example, "no" is the negation phrase. Adding additional negation phrases wouldn't solve your issue.
The issue is that the scispacy language model's named entity recognition is not "chunking" that phrase together as a single entity. You could manually add a pipeline component of "entity ruler" which lets you use rules/dictionaries to add additional named entities. See the docs here https://spacy.io/usage/rule-based-matching#entityruler
If you did want to add custom negation patterns for another use case, see https://github.com/jenojp/negspacy#use-own-patterns-or-view-patterns-in-use
Closing issue
My code currently looks like -
The output is -
I want the output to be -
How can I consider phrases like "shortness of breath", "sore throat", "respiratory distress" as a single entity.
I was thinking of adding this custom phrases to add in negation.py line 81. how can I do that? is there any other approach with which I can resolve this issue.