Does the iOS Speech API support grammar?

I studied various speech recognition strategies and liked the grammar as defined in the Web Speech specification . It seems that if you can tell the speech recognition service that you expect "Yes" or "No", the service can more reliably recognize "Yes" as "Yes", "No" as "No", and hopefully can also say: "it sounded none of these!"

However, SFSpeechRecognitionRequest

I see only taskHint

with the values of , , and .SFSpeechRecognitionTaskHint

confirmation

dictation

search

unspecified

I can see it too SFSpeechRecognitionRequest.contextualStrings

, but it looks like a different target. I think I should put the brand / trademark stuff in there. Typing "Yes" and "No" would not make these words more likely to be selected, because they already exist in the system dictionary (I'm making this assumption based on a little documentation).

Is there a way with the API to do something more like grammar or, even easier, just provide a list of expected phrases so that speech recognition will most likely come up with the result I expect instead of similar audible gibberish / homophones? Could it contextualStrings

increase the likelihood that the system will select one of these lines instead of just expanding the system dictionary? Or maybe I am wrong and I have to apply the grammar myself and list SFSpeechRecognitionResult.transcriptions

until I find one suitable expected word

Unfortunately, I cannot test these APIs myself; I'm just exploring the viability of writing a native iOS app and don't have the required development environment.

+1


source to share





All Articles