Questions tagged «speech-to-text»


3
Android RecognitionListener:onResults被调用两次
我有一个使用Kotlin编写的使用RecognitionListener的项目。语音到文本功能始终是成功的,从未出现任何问题。 从上周开始,它的onResult函数开始被调用两次。该项目未做任何更改。我测试了该项目的旧版本(从几个月前开始),这些版本都存在相同的问题。 有三种不同的情况: 小文本(1到8个单词)和SpeechRecognizer自动停止-> onResult()调用了两次; 大文本(9个单词或更多)和SpeechRecognizer自动停止->正常行为(onResult()调用一次); 手动调用任何文本大小和SpeechRecognizer stopListening()函数(从代码)->正常行为。 这是VoiceRecognition语音转文字类代码: class VoiceRecognition(private val activity: Activity, language: String = "pt_BR") : RecognitionListener { private val AudioLogTag = "AudioInput" var voiceRecognitionIntentHandler: VoiceRecognitionIntentHandler? = null var voiceRecognitionOnResultListener: VoiceRecognitionOnResultListener? = null //Must have this var voiceRecognitionLayoutChanger: VoiceRecognitionLayoutChanger? = null var isListening = false private val …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.