This commit is contained in:
team3
2026-07-06 20:30:15 +02:00
parent 9c55b05373
commit 1441c01f2c
6 changed files with 16 additions and 12 deletions

View File

@@ -97,9 +97,15 @@ def _corpus_texts(topic: str) -> dict[str, str]:
out = {}
for f in sorted(folder.glob("*.txt")):
try:
out[f.name] = f.read_text(encoding="utf-8")
text = f.read_text(encoding="utf-8")
except OSError:
continue
# QUELLE:-Header (Metadata, kein Lerninhalt) strippen — sonst bildet er bei großen
# Seiten einen isolierten, block-losen Abschnitt = False-Positive-Lücke.
lines = text.splitlines()
if lines and lines[0].startswith("QUELLE:"):
text = "\n".join(lines[1:]).lstrip("\n")
out[f.name] = text
return out