A toolkit for clinical NLP with spaCy. Features include sentence splitting, section detection, and asserting negation, family history, and uncertainty.
import medspacy from medspacy.ner import TargetRule nlp = medspacy.load() print(nlp.pipe_names) nlp.get_pipe('target_matcher').add([TargetRule('stroke', 'CONDITION'), TargetRule('diabetes', 'CONDITION'), TargetRule('pna', 'CONDITION')]) doc = nlp('Patient has hx of stroke. Mother diagnosed with diabetes. No evidence of pna.') for ent in doc.ents: print(ent, ent._.is_negated, ent._.is_family, ent._.is_historical) medspacy.visualization.visualize_ent(doc)
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.