ru_RU离线语音识别

时间:2019-06-26 09:10:50

标签: c# visual-studio xamarin.forms xamarin.android speech-recognition

脱机识别不适用于ru_RU,但与en_US和de_DE兼容。 已下载所有离线字典。 那么我如何使用ru_RU!来完成这项工作??。

小米Redmi 3s Android 6.0-API 23 google搜索最新版本

var recListener = new RecognitionListener();

recListener.BeginSpeech += RecListener_BeginSpeech;
recListener.EndSpeech += RecListener_EndSpeech;
recListener.Error += RecListener_Error;
recListener.Ready += RecListener_Ready;
recListener.Recognized += RecListener_Recognized;

Recognizer = SpeechRecognizer.CreateSpeechRecognizer(this);
Recognizer.SetRecognitionListener(recListener);

SpeechIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
SpeechIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm );
SpeechIntent.PutExtra(RecognizerIntent.ExtraCallingPackage, PackageName);
SpeechIntent.PutExtra(RecognizerIntent.ActionRecognizeSpeech,RecognizerIntent.ExtraPreferOffline  );
SpeechIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500);
SpeechIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
SpeechIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
SpeechIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);

string str;
str = "ru_RU";
//Java.Util.Locale.Default.ToString();

SpeechIntent.PutExtra(RecognizerIntent.ExtraLanguage, str);

此代码将引发SpeechRecognizer.Error.SERVER

0 个答案:

没有答案