Bruno Coelho
Bruno Coelho

Reputation: 946

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

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

Upvotes: 0

Views: 447

Answers (1)

Ross Knipe
Ross Knipe

Reputation: 519

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

Upvotes: 1

Related Questions