What is Entity Linking?
Entity Linking is a natural language processing task that involves identifying and disambiguating mentions of real-world entities, such as people, organizations, and locations, within a text. The goal of entity linking is to map entity mentions to their corresponding entries in a knowledge base or an external database, enabling the extraction of structured information from unstructured text.
Example of Entity Linking using SpaCy in Python:
import spacy # Load the SpaCy English model with NER support nlp = spacy.load("en_core_web_sm") # Process a text with entity mentions text = "Apple is an American technology company headquartered in Cupertino, California." doc = nlp(text) # Print the entity mentions and their links to the knowledge base for ent in doc.ents: print(ent.text, ent.label_, ent.kb_id_)
In this example, we use the SpaCy library to perform entity linking on a sample text. The output displays the entity mentions, their labels, and their knowledge base IDs.