Entity linker for historical German (Wikidata and GND)
Links names in historical German text to Wikidata items and, where German Wikipedia records one, to GND identifiers, or returns no link. For archives and digital humanities projects that need a permissive licence. Input: a text and the character spans of its names, for example from ner-german-historic-large. Licence: CC BY-SA 4.0.
Usage
Demo in the browser: historical-german-entity-linking-demo.
import sys
from huggingface_hub import snapshot_download, hf_hub_download
model_dir = snapshot_download("13fragments/entity-linker-german-historic-large", allow_patterns=["*.json", "*.py", "*.safetensors"])
index = hf_hub_download("13fragments/entity-index-german-wikipedia", "index.sqlite", repo_type="dataset")
sys.path.insert(0, model_dir)
from linker import Linker
linker = Linker(model_dir, index) # or backend="onnx", onnx_file="onnx/model_quantized.onnx"
text = "Der Kaiſer reiſte von Wien nach Innsbruck; Erzherzog Karl Ludwig begleitete ihn."
for r in linker.link(text, [(22, 26), (32, 41), (43, 64)]):
print(r["surface"], r["qid"], r["gnd"]) # Wien Q1741 4066009-6, ...
Scores
impresso-project/nel-mgenre-multilingual (CC BY-NC 4.0, non-commercial) is more accurate on every set we measured.
Use it if its licence fits your use.
66 letters from about 1800 that no compared model was trained on, 1,655 person names, one run of the released model:
| System | F1 | Linked accuracy | NIL accuracy |
|---|---|---|---|
| This model | 0.409 | 0.331 | 0.717 |
| impresso (CC BY-NC 4.0) | 0.473 | 0.357 | 0.911 |
| Name prior | 0.206 | 0.222 | 0.104 |
Release gate (historical newspapers, NewsEye and SoNAR test, 4 seeds): F1 0.540 ± 0.010 against 0.399 for the name prior; it passed. impresso scores 0.808 there, but it was trained on these sources.
Training data
- German Wikipedia link contexts (dump of 2026-11-06, CC BY-SA 4.0) and NewsEye German training data (CC BY 4.0).
- Base model
FacebookAI/xlm-roberta-large(MIT). Attributions are inNOTICE.
Evaluation sets
The letters set (CC BY 3.0 DE) and the NewsEye test set (CC BY 4.0) are in eval/. The SoNAR test set is part of
HIPE-2022.
Limits
- Candidates come only from German Wikipedia: the right entity is among the 16 candidates for 78 % of linked validation names.
- Person names in letters are hard: the model gives the right QID for 32 % of the linked one-word names (1,012) and 38 % of the longer ones.
- Organisations are weak: F1 0.321 on NewsEye test.
- In a browser without a GPU, the demo needs about 43 s per name (headless Chromium, 4 threads).
Every score with its seed count, every comparison, the export checks and the failure cases: eval/RESULTS.md.
Publisher: 13fragments