This commit is contained in:
team3
2026-07-08 23:46:35 +02:00
parent f9d77a113b
commit 2178c6faf4
15 changed files with 557 additions and 379 deletions

View File

@@ -209,11 +209,18 @@ def _stem(t: str) -> str:
def _named_results(corpus: dict[str, str]) -> dict[str, set[str]]:
"""Named/attributed corpus results → {concept name: distinctive stems}. A bare 'Satz 7.18'
(number, no name) yields nothing to match. Same catalogue vocabulary as the title strip."""
(number, no name) yields nothing to match. Same catalogue vocabulary as the title strip.
Umbruch-Schutz (generisch): endet ein Doppelpunkt-Fang am Zeilenumbruch und läuft die
nächste Zeile klein weiter, ist es ein UMBROCHENER SATZ, kein Name — solche Fragmente
(„Satz 6.16: Wenn ein … in P⏎liegt …") kann kein Block je ankern (Phantom-Lücke)."""
out: dict[str, set[str]] = {}
for text in corpus.values():
for m in _NAMED_RESULT_RE.finditer(text):
name = (m.group(1) or m.group(2) or "").strip()
if m.group(2) and m.end() > 0 and text[m.end() - 1] == "\n":
rest = text[m.end():].lstrip(" \t")
if rest[:1].islower():
continue # Satzfragment: Fortsetzung klein auf der nächsten Zeile
toks = _distinctive(name)
if len(name) >= 3 and toks:
out.setdefault(name, set()).update(_stem(t) for t in toks)