feat(nlp-service): NER person name extraction

This commit is contained in:
Marcel
2026-06-07 10:21:16 +02:00
committed by marcel
parent 482a1c2863
commit deea34c797
2 changed files with 52 additions and 0 deletions

View File

@@ -31,3 +31,10 @@ def get_nlp(lang: str) -> Language:
def load_all_models() -> None:
for lang in _MODEL_NAMES:
get_nlp(lang)
# ── Step 1: Person name extraction ──────────────────────────────────────────
def extract_person_names(doc) -> list[str]:
"""Return PER entity texts in left-to-right span order."""
return [ent.text for ent in doc.ents if ent.label_ == "PER"]