Universe

negspaCy

spaCy pipeline object for negating concepts in text based on the NegEx algorithm.

negspacy is a spaCy pipeline component that evaluates whether Named Entities are negated in text. It adds an extension to 'Span' objects.

Example

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)

View more
Author info

Jeno Pizarro

GitHubjenojp/negspacy

Categories pipeline scientific

Submit your project

If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea label on the issue tracker.

Read the docsJSON source