Android自带的谷歌SpeechRecognizer目前不支持离线识别。它需要连接到谷歌服务器进行语音识别。

如果需要离线识别,可以考虑使用第三方的语音识别库,如百度语音识别、讯飞语音识别等。

以下是讯飞语音识别的示例代码和git地址:

示例代码:

// 初始化识别对象
SpeechRecognizer mIat = SpeechRecognizer.createRecognizer(this, null);
// 设置参数
mIat.setParameter(SpeechConstant.LANGUAGE, "zh_cn");
mIat.setParameter(SpeechConstant.ACCENT, "mandarin");
mIat.setParameter(SpeechConstant.ENGINE_TYPE, SpeechConstant.TYPE_LOCAL); // 设置本地识别
// 开始识别
mIat.startListening(mRecognizerListener);

git地址:https://github.com/iflytek-dev/AndroidVoiceSDKDem

Android自带的谷歌SpeechRecognizer如何进行离线识别?有示例git地址吗

原文地址: https://www.cveoy.top/t/topic/fjgi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录