android - SpeechRecognizer 离线 ERROR_NO_MATCH

标签 android speech-recognition recognizer-intent

当设备离线时,SpeechRecognizer 在 onPartialResults() 回调中返回部分结果时在 onResults 中返回 ERROR_NO_MATCH。上次我玩 SpeechRecognizer 时它在离线状态下运行良好,我想知道是否有人找到了解决方案。

最佳答案

作为解决方法,我使用 onPartialResults() 中返回的 partialResults。 在返回的包中,“SpeechRecognizer.RESULTS_RECOGNITION”包含所有术语减去最后一个术语,“android.speech.extra.UNSTABLE_TEXT”包含最后一个缺失的识别术语。

    @Override
public void onPartialResults(Bundle partialResults) {
    ArrayList<String> data = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    ArrayList<String> unstableData = partialResults.getStringArrayList("android.speech.extra.UNSTABLE_TEXT");
    mResult = data.get(0) + unstableData.get(0);
}

关于android - SpeechRecognizer 离线 ERROR_NO_MATCH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30654191/

相关文章:

android - 什么时候更新 ViewPager 的信息?

linux - HTK:HCompV ReadString:字符串太长

android - Android 应用中使用 RecognizerIntent 的数据安全性

android - 如何从具有 singleInstance 启动模式的 Activity 中正确启动语音识别 Activity ?

android - 从广播事件切换到奥托有什么好处

Android BLE 启用通知

android - 通知未出现在应用程序的后台状态和终止状态

python - Python Speech_recognition无法检测到麦克风的音频

android - Android 中的语音识别服务

Android RecognizerIntent 语音识别