Implemented a validation step to confirm that grammatical changes do not change substantive meaning
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import json
|
||||
|
||||
from audita.chunking import chunk_transcript
|
||||
from audita.prompts import build_glossary_correction_messages, build_grammar_correction_messages
|
||||
from audita.prompts import (
|
||||
build_glossary_correction_messages,
|
||||
build_grammar_correction_messages,
|
||||
build_grammar_validation_messages,
|
||||
)
|
||||
from audita.schemas import parse_glossary_yaml, parse_transcript_json
|
||||
|
||||
|
||||
@@ -169,3 +173,27 @@ def test_grammar_prompt_uses_simplified_segment_payload():
|
||||
assert "speaker" not in prompt_segments[0]
|
||||
assert "start" not in prompt_segments[0]
|
||||
assert "end" not in prompt_segments[0]
|
||||
|
||||
|
||||
def test_grammar_validation_prompt_rejects_semantic_changes():
|
||||
messages = build_grammar_validation_messages(
|
||||
[
|
||||
{
|
||||
"correction_index": 0,
|
||||
"id": 1,
|
||||
"original_segment_text": "He became visible.",
|
||||
"corrected_segment_text": "He became invisible.",
|
||||
"original_text": "visible",
|
||||
"corrected_text": "invisible",
|
||||
}
|
||||
]
|
||||
)
|
||||
prompt_text = "\n".join(message["content"] for message in messages)
|
||||
|
||||
assert "preserves meaning" in prompt_text
|
||||
assert "became visible" in prompt_text
|
||||
assert "became invisible" in prompt_text
|
||||
assert "reverses the meaning" in prompt_text
|
||||
assert "spelling and homophone fixes only when" in prompt_text
|
||||
assert "correction_index" in prompt_text
|
||||
assert "is_meaning_preserving" in prompt_text
|
||||
|
||||
Reference in New Issue
Block a user