Implemented a shared, more permissive editorial validatior for the grammar and spoken_word modules

This commit is contained in:
2026-05-01 07:01:51 -05:00
parent 0d5bdd1c84
commit 9ab5a60123
5 changed files with 75 additions and 69 deletions

View File

@@ -860,7 +860,7 @@ def test_process_transcript_result_rejects_grammar_below_threshold_before_later_
assert result.report.modules[0].validators[3].candidate_count == 0
def test_process_transcript_result_grammar_module_still_rejects_homophone_style_proposals(tmp_path):
def test_process_transcript_result_grammar_module_allows_editorial_homophone_style_proposals(tmp_path):
transcript = parse_source_transcript_json(
"""
[
@@ -902,9 +902,9 @@ def test_process_transcript_result_grammar_module_still_rejects_homophone_style_
"validations": [
{
"correction_index": 0,
"approved": False,
"confidence": 0.99,
"reason": "Free-standing homophone rewrite rather than conservative grammar cleanup.",
"approved": True,
"confidence": 0.94,
"reason": "A low-risk editorial homophone correction that preserves meaning.",
}
]
},
@@ -929,14 +929,13 @@ def test_process_transcript_result_grammar_module_still_rejects_homophone_style_
llm_client=client,
)
assert result.transcript[0].text == "ChatGPT still can't really do that with a dam."
assert result.transcript[0].text == "ChatGPT still can't really do that with a damn."
assert [call["stage_name"] for call in client.calls] == [
"grammar:proposal",
"grammar:grammar_only_guard",
"grammar:meaning_reversal_review",
]
assert result.report.skipped_corrections[0].source == "validator:grammar_only_guard"
assert "grammar cleanup" in result.report.skipped_corrections[0].reason
assert result.report.skipped_corrections == []
def test_process_transcript_result_grammar_module_allows_embedded_homophone_fix_with_grammar_cleanup(tmp_path):