如何解决我想迅速识别来自SFSpeechRecognizer的单词
所以基本上我想在我的应用程序中使用语音来文本,用户可以通过呼叫他们的答案号码来选择一个选项,例如:12,35等,他们是多个答案,除了可以合并数字之外,其他一切都很好,例如 如果用户通过语音选择了30号答案,它将很好地解决问题(将选择30号),但是当用户可以更改20号答案时,结果将是3020,且无法识别
这是我的代码
func startSpeechRecognization(){
let node = audioEngine.inputNode
let recordingFormat = node.outputFormat(forBus: 0)
node.installTap(onBus: 0,bufferSize: 1024,format: recordingFormat) { (buffer,_)
in
self.request.append(buffer)
}
audioEngine.prepare()
do {
try audioEngine.start()
} catch let error {
// alertView(message: "Error comes here for starting the audio listner =\(error.localizedDescription)")
}
guard let myRecognization = SFSpeechRecognizer() else {
// self.alertView(message: "Recognization is not allow on your local")
return
}
if !myRecognization.isAvailable {
// self.alertView(message: "Recognization is free right Now,Please try again after some time.")
}
self.task = speechReconizer?.recognitionTask(with: request,resultHandler: { (response,error) in
guard let response = response else {
var isFinal = false
if error != nil {
// self.alertView(message: error.debugDescription)
}else {
// self.alertView(message: "Problem in giving the response")
}
return
}
self.texting = ""
let message = response.bestTranscription.formattedString
self.texting = message
print(self.texting)
self.table.reloadData()
})
}
语音对文本的第一,第二和第三结果:first result :40(works fine) second result 4039(unrecognisable) it will be only 39
third result 40 3940(unrecognisable) it will be only 40 because i choose 40 again
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。