简体   繁体   中英

is on-device speech recognition a thing?

New in iOS 13, you're supposed to be able to say this ( import Speech ):

let req = SFSpeechAudioBufferRecognitionRequest()
let loc = Locale(identifier: "en-US")
guard let rec = SFSpeechRecognizer(locale:loc)
    else {print("no recognizer"); return}
print("rec isAvailable says: \(rec.isAvailable)")
if rec.supportsOnDeviceRecognition {
    print("on device recognition")
    req.requiresOnDeviceRecognition = true
} else {
    print("no on device recognition")
}

The trouble is that I get "no on device recognition" on all my devices. I can do speech recognition just fine; I just can't do on-device speech recognition. Is this feature real, or is it merely aspirational on Apple's part?

It's likely you're running into a known issue with supportsOnDeviceRecognition on 13.1. From the iOS/iPadOS 13.1 Release Notes :

The supportsOnDeviceRecognition property always returns false the first time it's accessed. After a few seconds, accessing it again returns the correct value. (47822242)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM