Candidate ranking scores and orders possible reference entities after named entity recognition and candidate selection. Contextual words surrounding a mention determine the scores; the highest-scoring candidate becomes the linked target. section 7.2
A typical knowledge-base entity-disambiguation pipeline is:
- Recognize named entity mentions. section 7.2
- Select possible candidates from a structured knowledge base. section 7.2
- Rank candidates using contextual information and use the highest score for linking. section 7.2
- Integrate linked entities with domain ontologies into a unified knowledge graph. section 7.2
Zika disambiguation
For “Zika virus,” scispaCy ranks Zika Virus (C0318793) first, while “Zika virus infection” ranks Zika Virus Infection (C0276289) first. The same surface term can therefore resolve to different UMLS entities by context.
Listing 7.1 Selecting and ranking candidates with the scispaCy model
import spacy
from scispacy.linking import EntityLinker
nlp = spacy.load("en_core_sci_md")
nlp.add_pipe("scispacy_linker",
config={"resolve_abbreviations": True, "linker_name": "umls"})
linker = nlp.get_pipe("scispacy_linker")
linker_dict = linker.kb.cui_to_entity
doc = nlp("""In the week of 13 April, Belize reported for the first time
mosquito-borne Zika virus transmission. Update on the observed increase
of congenital Zika syndrome and other neurological complications
Microcephaly and other fetal malformations potentially associated with
Zika virus infection.""")
for ent in doc.ents:
if "Zika" in ent.text:
print("Recognized entity:", ent.text, ent.start_char, ent.end_char)
print("Ranked target candidates:")
for kb_ent in ent._.kb_ents:
print('-', linker_dict[kb_ent[0]][0], linker_dict[kb_ent[0]][1])
A scispaCy implementation loads an NLP model, configures UMLS linking, processes biomedical text, and prints ranked candidates. section 7.2
