diff --git a/docs/requirements/013-voice-input.md b/docs/requirements/013-voice-input.md index a9bada1..fa7b0d0 100644 --- a/docs/requirements/013-voice-input.md +++ b/docs/requirements/013-voice-input.md @@ -28,6 +28,13 @@ keyboard on a desktop and on a small screen. works with mouse, touch and keyboard. 7. **Order**: built in parallel with 012 in its own sidetree; 012's feedback popup and marks get the microphone through the shared component. +8. **German fixture (operator-confirmed 2026-11-17)**: the local small model + detects a two-word "hallo welt" clip as English, recorded and spoken by + espeak-ng alike, while it detects a German sentence as German; the + German fixture is the espeak-ng sentence "Hallo Welt, heute teste ich die + Spracheingabe." and its criterion checks the language and the start of + the transcript. Rejected: a recording by the operator, keeping the + two-word fixture with an open criterion. ## Approach @@ -60,8 +67,10 @@ flowchart TD ### Transcription -- [ ] A POST of the German fixture WAV to `/api/stt` returns "hallo welt", - the English fixture returns "hello world". +- [ ] A POST of the German fixture WAV, the sentence "Hallo Welt, heute + teste ich die Spracheingabe." spoken by espeak-ng, to `/api/stt` + returns language `de` and a transcript starting with "hallo welt"; the + English fixture returns language `en` and "hello world". - [ ] The transcription's temp directory is empty after each request, including a failed one. - [ ] A request from another origin, without the CSRF token, over 60 s or diff --git a/tests/fixtures/voice/hallo-welt.wav b/tests/fixtures/voice/hallo-welt.wav index 1380a77..1701106 100644 Binary files a/tests/fixtures/voice/hallo-welt.wav and b/tests/fixtures/voice/hallo-welt.wav differ diff --git a/tests/test_hub_voice_model.py b/tests/test_hub_voice_model.py index 11f8106..2248fe0 100644 --- a/tests/test_hub_voice_model.py +++ b/tests/test_hub_voice_model.py @@ -25,11 +25,12 @@ class TestVoiceModel(HubCase): def test_the_real_model_transcribes_the_german_and_the_english_fixture(self): speech = self.httpd.hub.speech with mock.patch.object(speech, "engines", dataclasses.replace(speech.engines, whisper=WHISPER, whisper_model=MODEL)): - for name, words in (("hallo-welt.wav", "hallo welt"), ("hello-world.wav", "hello world")): + for name, language, words in (("hallo-welt.wav", "de", "hallo welt"), ("hello-world.wav", "en", "hello world")): with self.subTest(name=name): status, _, body = self.call("POST", "/api/stt", (FIXTURES / name).read_bytes(), {**self.guard(self.host), "Content-Type": "audio/wav"}) self.assertEqual(status, 200, body) - self.assertEqual(spoken(json.loads(body)["text"]), words) + found = json.loads(body) + self.assertEqual((found["language"], spoken(found["text"]).startswith(words)), (language, True), found) if __name__ == "__main__":