How to use iOS 10 speech recognition?

How to write audio to text in iOS10 using Speech.framework?

+4
source share
1 answer

It is very simple, just a few lines of code.

let recognizer = SFSpeechRecognizer()  
let request = SFSpeechURLRecognitionRequest(url: audioFileURL)
recognizer?.recognitionTask(with: request, resultHandler: { (result, error)   in  
     if let error = error {
        print("There was an error: \(error)")
     } else {
        print (result?.bestTranscription.formattedString)
     }
})  

Note:
As with accessing other types of secure data, such as calendar and photo data, voice recognition requires user permission (for more information about accessing secure data classes, see "Security and privacy improvements").

, , . , NSSpeechRecognitionUsageDescription Info.plist .

Refer: http://saravnandm.blogspot.in/2016/06/ios10-speech-recognition-in-ios-10_23.html

+8

All Articles