Teach iOS SFSpeechRecognizer custom words (medication names, chemistry terms, etc)

257 Views Asked by At

I have a question regarding the integration of the speech to text iOS library called SFSpeechRecognizer. I need SFSpeechRecognizer to recognize terms that are not present in the iOS dictionary like medication names, chemistry terms, etc. I would have to add them, somehow, for SFSpeechRecognizer to be able to recognise them. Is this possible? Thanks

1

There are 1 best solutions below

0
Ross Knipe On

Add your words to the

SFSpeechRecognitionRequest.contextualStrings array:

 let request = SFSpeechURLRecognitionRequest(url: fileUrl)
 request.contextualStrings = ["twersht", "baglom"]

now "My baglom is very twersht" will be returned by the SFSpeechRecognizer after you say it.

contextualStrings reference