Now I want to use Python to see the voice recognizer's expected words.
However, just one word is being broadcast continually, and no other projected word can be observed at this time.
So when I looked up the function, I saw NBest and wanted to include it, but I couldn't figure out how.
Where should I place the Nbest in the code below?
-----------------------------------------------------------------------------------
Example) https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-speech-to-text#query-parameters
{
"RecognitionStatus": "Success",
"Offset": "1236645672289",
"Duration": "1236645672289",
"NBest": [
{
"Confidence": 0.9052885,
"Display": "What's the weather like?",
"ITN": "what's the weather like",
"Lexical": "what's the weather like",
"MaskedITN": "what's the weather like"
},
{
"Confidence": 0.92459863,
"Display": "what is the weather like",
"ITN": "what is the weather like",
"Lexical": "what is the weather like",
"MaskedITN": "what is the weather like"
}
]
}
------------------------------------------------------------------------------------------------------
speech_key = subscription_key
service_region = 'koreacentral'
config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
recognizer = speechsdk.SpeechRecognizer(speech_config=config, language="ko-KR")
result = recognizer.recognize_once_async().get()
if result.reason == speechsdk.ResultReason.RecognizedSpeech:
print("Recognized: {}".format(result.text))
elif result.reason == speechsdk.ResultReason.NoMatch:
print("No speech could be recognized: {}".format(result.no_match_details))
elif result.reason == speechsdk.ResultReason.Canceled:
cancellation_details = result.cancellation_details
print("Speech Recognition canceled: {}".format(cancellation_details.reason))
if cancellation_details.reason == speechsdk.CancellationReason.Error:
print("Error details: {}".format(cancellation_details.error_details))