PRODUCTION SCENARIO
A Python app uses the Speech SDK to call recognize_once_async() from the default microphone. When the caller stays silent or the endpoint value is wrong, the result text is empty and the app crashes on it.
What should the app check before using the transcript?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: The result reason, branching on NoMatch and Canceled
The quickstart branches on the result reason: RecognizedSpeech yields text, NoMatch means no speech could be recognized, and Canceled carries cancellation details whose error message points at a bad key or endpoint. The recognition language degrades accuracy without emptying the result. cancellation_details only exists once the reason is Canceled, so reading it first is the inverted order. A confidence score exists only once a hypothesis does.