Search code examples
pythonazurenlpspeech-recognitionazure-speech

How can I get only text part out of recognised object in Microsoft Speech Service


Following is my output of speech recognition from file from Microsoft Azure Speech SDK. I want to know how can I extract just the 'text' part from this output rather than complete.

SpeechRecognitionEventArgs(session_id=e28f6907838640e191f214035d69f5e0, result=SpeechRecognitionResult(result_id=c27fa5b36bcd466f8162ca3c6ce5f935, text="Hello good morning, my name is Arihant. How may I help you?", reason=ResultReason.RecognizedSpeech))

CANCELED SpeechRecognitionCanceledEventArgs(session_id=e28f6907838640e191f214035d69f5e0, result=SpeechRecognitionResult(result_id=5681af6a81994a76a11b7e94307c7c2e, text="", reason=ResultReason.Canceled))

CLOSING on SessionEventArgs(session_id=e28f6907838640e191f214035d69f5e0)


Solution

  • If this is the below code you are using :

    speech_recognizer.recognized.connect(lambda evt: print('RECOGNIZED: {}'.format(evt)))
    

    You could get the text only using evt.result