Preserve alignment edits without ASR words
Some checks failed
ci / test-and-build (push) Has been cancelled
Some checks failed
ci / test-and-build (push) Has been cancelled
Keep transcript-only runs eligible for alignment heuristics instead of bailing out when the ASR stage does not supply word timings. Build fallback AsrWord entries from the transcript so cue-based corrections like "i mean" still apply, while reusing the existing literal guard for verbatim phrases. Cover the new path in alignment and pipeline tests, and validate with python3 -m unittest tests.test_alignment_edits tests.test_pipeline_engine.
This commit is contained in:
parent
8169db98f4
commit
c4433e5a20
3 changed files with 71 additions and 7 deletions
|
|
@ -93,6 +93,23 @@ class PipelineEngineTests(unittest.TestCase):
|
|||
self.assertEqual(result.fact_guard_action, "accepted")
|
||||
self.assertEqual(result.fact_guard_violations, 0)
|
||||
|
||||
def test_run_transcript_without_words_applies_i_mean_correction(self):
|
||||
editor = _FakeEditor()
|
||||
pipeline = PipelineEngine(
|
||||
asr_stage=None,
|
||||
editor_stage=editor,
|
||||
vocabulary=VocabularyEngine(VocabularyConfig()),
|
||||
alignment_engine=AlignmentHeuristicEngine(),
|
||||
)
|
||||
|
||||
result = pipeline.run_transcript("schedule for 5, i mean 6", language="en")
|
||||
|
||||
self.assertEqual(editor.calls[0]["transcript"], "schedule for 6")
|
||||
self.assertEqual(result.output_text, "schedule for 6")
|
||||
self.assertEqual(result.alignment_applied, 1)
|
||||
self.assertEqual(result.fact_guard_action, "accepted")
|
||||
self.assertEqual(result.fact_guard_violations, 0)
|
||||
|
||||
def test_fact_guard_fallbacks_when_editor_changes_number(self):
|
||||
editor = _FakeEditor(output_text="set alarm for 8")
|
||||
pipeline = PipelineEngine(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue