简体   繁体   English

SFSpeechRecognizer 同时请求?

[英]SFSpeechRecognizer Simultaneous Requests?

I am trying to use SFSpeechRecognizer to transcribe spoken commands in my app.我正在尝试使用 SFSpeechRecognizer 在我的应用程序中转录语音命令。 The commands are only one word.命令只有一个字。 The SFSpeechAudioBufferRecognitionRequest (from microphone tap) can take a few seconds to ultimately come back with an accurate transcription of that word, but that is fine for my use case. SFSpeechAudioBufferRecognitionRequest(来自麦克风点击)可能需要几秒钟才能最终返回该单词的准确转录,但这对我的用例来说很好。

However, in my use case, a new command may come in before those few seconds have elapsed.但是,在我的用例中,可能会在这几秒钟过去之前输入一个新命令。 How can I start processing a new request while still allowing the previous request to continue refining its result (ie, without prematurely stopping the previous request)?如何开始处理新请求,同时仍允许前一个请求继续优化其结果(即,不会过早停止前一个请求)?

I have googled endlessly, and there seems to be no documentation on simultaneous/concurrent requests from microphone input.我无休止地用谷歌搜索,似乎没有关于麦克风输入的同时/并发请求的文档。

Any thoughts would be greatly appreciated!任何想法将不胜感激!

Something that I've been able to accomplish with iOS 13 is running two SFSpeechRecognitionTasks for two different SFSpeechAudioBufferRecognitionRequest simultaneously by having one with requiresOnDeviceRecognition set to true and one with requiresOnDeviceRecognition set to false.我已经能够使用 iOS 13 完成的事情是同时为两个不同的 SFSpeechAudioBufferRecognitionRequest 运行两个 SFSpeechRecognitionTask,方法是将一个 requiresOnDeviceRecognition 设置为 true,另一个将 requiresOnDeviceRecognition 设置为 false。

I found that you can't run two on-device requests simultaneously, and you also can't run two off-device requests simultaneously - but by having one required to be on-device, you can be transcribing/processing one while listening and transcribing with the other.我发现你不能同时运行两个设备上的请求,你也不能同时运行两个设备外的请求——但是通过要求一个在设备上,你可以在听和的同时转录/处理一个请求与另一个转录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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