More bugfixes in the glossary protection guard module

This commit is contained in:
2026-04-22 12:17:52 -05:00
parent 15cdf01f58
commit 87c47517a0
9 changed files with 269 additions and 28 deletions

View File

@@ -119,6 +119,49 @@ def test_glossary_stage_can_correct_toward_protected_term(tmp_path):
assert list((tmp_path / "work").iterdir()) == []
def test_glossary_guard_ignores_unrelated_protected_terms_elsewhere_in_segment(tmp_path):
transcript = parse_source_transcript_json(
"""
[
{"speaker": "Eric", "start": 0.0, "end": 1.0, "text": "The gestures are near lyra."}
]
"""
)
glossary = parse_glossary_yaml(
"""
glossary:
- name: "Jesters"
category: faction
summary: "The Jesters are a faction."
- name: "Lyra"
category: npc
summary: "Lyra is an NPC."
"""
)
glossary_correction = CorrectionCandidate(
id=1,
original_text="gestures",
corrected_text="Jesters",
confidence=0.95,
)
fake_client = FakeLLMClient(
[
CorrectionSet(corrections=[glossary_correction]),
CorrectionSet(corrections=[]),
]
)
revised = process_transcript(
transcript,
glossary,
_config(tmp_path),
llm_client=fake_client,
)
assert revised[0].text == "The Jesters are near lyra."
assert list((tmp_path / "work").iterdir()) == []
def test_glossary_stage_cannot_change_away_from_protected_term(tmp_path):
transcript = parse_source_transcript_json(
"""