A spaCy pipeline object for negation.
Project description
negspacy: negation for spaCy
spaCy pipeline object for negating concepts in text. Based on the NegEx algorithm.
NegEx - A Simple Algorithm for Identifying Negated Findings and Diseasesin Discharge Summaries Chapman, Bridewell, Hanbury, Cooper, Buchanan
Installation and usage
Install the library.
pip install negspacy
Import library and spaCy.
import spacy
from negspacy.negation import Negex
Load spacy language model. Add negspacy pipeline object. Filtering on entity types is optional.
nlp = spacy.load("en_core_web_sm")
negex = Negex(nlp, ent_types=["PERSON","ORG"])
nlp.add_pipe(negex, last=True)
View negations.
doc = nlp("She does not like Steve Jobs but likes Apple products.")
for e in doc.ents:
print(e.text, e._.negex)
Steve Jobs True
Apple False
Contributing
Authors
- Jeno Pizarro
License
API Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
negspacy-0.1.1.tar.gz
(4.1 kB
view details)
File details
Details for the file negspacy-0.1.1.tar.gz
.
File metadata
- Download URL: negspacy-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9062e8846e1ef7ae762552725bd04919c259f2a545eadd5bf65454f98a3ddb |
|
MD5 | 332b31ba092d4b18b0a63a7d48ea75b6 |
|
BLAKE2b-256 | 65c0ee1aea58099675960c6ce82bcdd88b6b8a6b112f9ee683a7bd800d4178a4 |