# Entity Linking

Source: https://www.potatoannotator.com/docs/guides/entity-linking

**Entity linking connects a mention in text to a specific entry in a knowledge base, resolving "Paris" to the city in France rather than the person, or to the city in Texas.** Where [named entity recognition](/docs/guides/named-entity-recognition) finds *that* something is an entity, entity linking decides *which* real-world entity it is.

See [Entity linking](https://en.wikipedia.org/wiki/Entity_linking) and the common targets [Wikidata](https://en.wikipedia.org/wiki/Wikidata) and [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia) for background. This is closely related to [word-sense disambiguation](https://en.wikipedia.org/wiki/Word-sense_disambiguation).

## What annotators do

1. A mention span is identified (often pre-marked from an NER pass).
2. The annotator searches the knowledge base and selects the matching entry.
3. If no entry fits, they mark it **NIL** (not in the knowledge base).

The NIL case is essential, without it, annotators force-fit mentions to wrong entries and corrupt the data.

## Setting it up in Potato

Potato supports entity linking with a typeahead search against a knowledge base (Wikidata, UMLS, or a custom list), so annotators pick from real candidates rather than typing IDs. The [entity linking showcase](/showcase/entity-linking) is a working example.

```yaml
annotation_schemes:
  - annotation_type: span
    name: mentions
    description: "Mark the mention to link."
    labels: [Entity]
  - annotation_type: text
    name: kb_id
    description: "Search the knowledge base and enter the matching ID, or write NIL if none fits."
```

## Quality considerations

- **Candidate quality.** A good typeahead with descriptions reduces wrong picks far more than longer guidelines.
- **Ambiguity defaults.** Tell annotators what to do when two entries seem equally valid.
- **Granularity.** Link to the company or the subsidiary? The film or the franchise? Decide once.

## Further reading

- [Named Entity Recognition](/docs/guides/named-entity-recognition)
- [Coreference Resolution](/docs/guides/coreference-resolution)
- [Span Annotation](/docs/guides/span-annotation)
