mooncak397
Claude Sonnet 5.5
M3: 23 new golden cases, promptfoo config, provider, code checks, v1 preliminary run (no judge)
88a53d6 Download evals/asserts/lang.py from christopher-dev/recruiter-assistant: direct link, hf CLI and curl.
- Browser
- Download file 678 Bytes
-
https://huggingface.co/spaces/christopher-dev/recruiter-assistant/resolve/main/evals/asserts/lang.py
- Command line
-
hf download hf://spaces/christopher-dev/recruiter-assistant/evals/asserts/lang.py
-
curl -L -o lang.py https://huggingface.co/spaces/christopher-dev/recruiter-assistant/resolve/main/evals/asserts/lang.py
678 Bytes
| """Language check (plan section 7): the lang field must match, and a small function-word count must agree.""" | |
| import re | |
| EN = {"the", "and", "is", "not", "you", "for", "he", "his", "of", "to", "at"} | |
| DE = {"der", "die", "und", "nicht", "sie", "ist", "für", "ein", "eine", "das", "bei", "er"} | |
| def words_agree(text: str, lang: str) -> bool: | |
| words = re.findall(r"[a-zäöüß]+", text.lower()) | |
| en, de = sum(w in EN for w in words), sum(w in DE for w in words) | |
| return de >= en if lang == "de" else en >= de # a tie passes: very short answers | |
| def lang_ok(out: dict, expected: str) -> bool: | |
| return out["lang"] == expected and words_agree(out["answer"], expected) | |