Ios 我想在swift中识别来自SFSpeechRecognizer的单词
所以基本上我想在我的应用程序中使用语音到文本,用户可以通过调用他们的答案号码来选择一个选项,例如:12,35等等,他们有多个答案,一切都很好,除了它会合并这些号码,例如 如果用户通过语音选择答案编号30,则该答案将正常工作(将选择编号30),但当用户可以更改编号20的答案时,结果将为3020,且无法识别其操作 这是我的密码Ios 我想在swift中识别来自SFSpeechRecognizer的单词,ios,swift,speech-to-text,siri,sfspeechrecognizer,Ios,Swift,Speech To Text,Siri,Sfspeechrecognizer,所以基本上我想在我的应用程序中使用语音到文本,用户可以通过调用他们的答案号码来选择一个选项,例如:12,35等等,他们有多个答案,一切都很好,除了它会合并这些号码,例如 如果用户通过语音选择答案编号30,则该答案将正常工作(将选择编号30),但当用户可以更改编号20的答案时,结果将为3020,且无法识别其操作 这是我的密码 func startSpeechRecognization(){ let node = audioEngine.inputNode
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()
})
}
语音对文本的第一、第二和第三个结果: