Implemented a second LLM stage for grammatical review
This commit is contained in:
@@ -144,6 +144,33 @@ def test_apply_corrections_replaces_all_repeated_substrings():
|
||||
assert result.skipped == []
|
||||
|
||||
|
||||
def test_apply_corrections_requires_unique_match_when_configured():
|
||||
transcript = parse_transcript_json(
|
||||
"""
|
||||
[
|
||||
{"id": 1, "speaker": "Eric", "start": 0.0, "end": 1.0, "text": "there and there"}
|
||||
]
|
||||
"""
|
||||
)
|
||||
correction = CorrectionCandidate(
|
||||
id=1,
|
||||
original_text="there",
|
||||
corrected_text="their",
|
||||
confidence=0.8,
|
||||
)
|
||||
|
||||
result = apply_corrections(
|
||||
transcript,
|
||||
[correction],
|
||||
confidence_threshold=0.8,
|
||||
replacement_mode="require_unique",
|
||||
)
|
||||
|
||||
assert result.transcript[0].text == "there and there"
|
||||
assert len(result.skipped) == 1
|
||||
assert "more than once" in result.skipped[0].reason
|
||||
|
||||
|
||||
def test_apply_corrections_skips_empty_original_text():
|
||||
transcript = _transcript()
|
||||
correction = CorrectionCandidate(
|
||||
@@ -163,3 +190,8 @@ def test_apply_corrections_skips_empty_original_text():
|
||||
def test_apply_corrections_rejects_invalid_threshold():
|
||||
with pytest.raises(AuditaValidationError):
|
||||
apply_corrections(_transcript(), [], confidence_threshold=1.1)
|
||||
|
||||
|
||||
def test_apply_corrections_rejects_invalid_replacement_mode():
|
||||
with pytest.raises(AuditaValidationError):
|
||||
apply_corrections(_transcript(), [], confidence_threshold=0.8, replacement_mode="unknown")
|
||||
|
||||
Reference in New Issue
Block a user