Created
February 11, 2021 12:05
-
-
Save AlexMikhalev/94863f1b1201f3e60730d5dd1aa6f078 to your computer and use it in GitHub Desktop.
UMLS scispacy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scispacy | |
import spacy | |
from scispacy.abbreviation import AbbreviationDetector | |
from scispacy.umls_linking import UmlsEntityLinker | |
nlp = spacy.load("en_core_sci_sm") | |
#^^^ at this import you area looking at 9 GB RAM consumption | |
#even before processing starts | |
# Add the abbreviation pipe to the spacy pipeline. | |
abbreviation_pipe = AbbreviationDetector(nlp) | |
nlp.add_pipe(abbreviation_pipe) | |
# Adding | |
# the AbbreviationDetector pipe and setting resolve_abbreviations to True means | |
# that linking will only be performed on the long form of abbreviations. | |
linker = UmlsEntityLinker(resolve_abbreviations=True) | |
nlp.add_pipe(linker) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment