KLAR / experiments /eval_filters.py
nicofirst1's picture
Publish KLAR reproducibility bundle (v1): text-free score bundles + analysis code for the 'Alles klar?' KlarText paper
f45e98c verified
Raw
History Blame Contribute Delete
821 Bytes
"""Corpus-filter constants for the paper eval (released path, no scorer import).
They are pure eval configuration, kept separate from the (closed-scorer-importing)
modules so the released analysis path can import them without touching the scorer.
"""
from __future__ import annotations
# Drop these subcorpora / title substrings before any paper statistic.
EXCLUDE_CORPUS = {"bible_workin_progress", "bible_awaiting_proof"}
EXCLUDE_SUBSTR = ("Märchen", "Marchen")
def keep(rec: dict) -> bool:
"""The paper's corpus filter: drop excluded subcorpora / fairy-tale titles.
`rec` needs only a `corpus` field (bundle rows pass `{"corpus": row["sub"]}`)."""
c = rec.get("corpus", "") or ""
if c in EXCLUDE_CORPUS:
return False
return all(sub.lower() not in c.lower() for sub in EXCLUDE_SUBSTR)