设备上的语音识别是一回事吗?

is on-device speech recognition a thing?

iOS13 的新功能,你应该可以这样说 (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")
}

问题是我的所有设备上都显示 "no on device recognition"。我可以很好地进行语音识别;我只是不能进行设备上的语音识别。这个功能是真实的,还是只是 Apple 的愿​​望?

您可能 运行 遇到了 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)