This commit is contained in:
Ján Pták 2026-09-28 02:24:14 +02:00
parent bf3103e868
commit b26fa231bd

View File

@ -144,3 +144,111 @@ def test_cesar_goal_matches_rozoznavat_variant() -> None:
"recognize unknown named entities", "recognize unknown named entities",
"Cieľom bolo rozoznávať neznáme pomenované entity.", "Cieľom bolo rozoznávať neznáme pomenované entity.",
) )
def test_negative_answer_accepts_semantic_no_answer_wording() -> None:
question = {
"category": "unanswerable_missing_fact",
"expected_answer_contains": [],
"expected_source_urls": [
"https://example.test/student"
],
"should_answer": False,
}
answer = (
"V dostupných dokumentoch ZP Wiki sa nepodarilo nájsť "
"informáciu o konkrétnom modeli GPU."
)
result = evaluate_answer(
question,
answer,
tool_called=True,
)
assert result["returned_no_answer"] is True
assert result["should_answer_ok"] is True
assert result["strict_pass"] is True
def test_negative_answer_does_not_require_source_url() -> None:
question = {
"category": "unanswerable_missing_fact",
"expected_answer_contains": [],
"expected_source_urls": [
"https://example.test/student"
],
"should_answer": False,
}
answer = (
"V dostupných dokumentoch ZP Wiki sa túto "
"informáciu nepodarilo spoľahlivo nájsť."
)
result = evaluate_answer(
question,
answer,
tool_called=True,
)
assert result["source_required_count"] == 0
assert result["source_url_score"] == 1.0
assert result["strict_pass"] is True
def test_spacy_goal_matches_expanded_slovak_wording() -> None:
assert expected_phrase_matches(
"Zlepšiť presnosť modelu Spacy pre slovenčinu",
(
"Cieľom bolo zlepšiť presnosť modelu Spacy "
"pre spracovanie slovenčine."
),
)
def test_small_context_matches_short_context() -> None:
assert expected_phrase_matches(
"príliš maly kontext",
"Modely mali problém s príliš krátkou dĺžkou kontextu.",
)
def test_slovak_hate_speech_matches_slovak_translation() -> None:
assert expected_phrase_matches(
"Slovak HATE speech",
"Úloha bola slovenská detekcia nenávistných prejavov.",
)
def test_slovak_question_answering_matches_translation() -> None:
assert expected_phrase_matches(
"Slovak question answering",
"Išlo o slovenské vyhľadávanie odpovedí na otázky.",
)
def test_named_matches_menovane_variant() -> None:
assert expected_phrase_matches(
"recognize unknown named entities",
"Cieľom bolo rozpoznať neznáme menované entity.",
)
def test_multilingual_matches_many_languages_wording() -> None:
assert expected_phrase_matches(
"multilinguálna extrakcia trojíc z medicínskych dát",
(
"Projekt riešil extrakciu trojíc z lekárskych dát "
"v mnohých jazykoch."
),
)
def test_medical_data_matches_medical_content() -> None:
assert expected_phrase_matches(
"Triplet extraction from medical data",
(
"Témou bolo multilingválne extrahovanie trojíc "
"z lekárskeho obsahu."
),
)