(Android版)如何设置语音识别语言的东西,我选择?如何设置、语音识别、东西、语言

2023-09-06 17:34:20 作者:怪咖骗傻瓜两奇葩

如何设置语音识别语言的东西,我选择?

例如,是否有东西,我可以改设为语音识别的语言?

我用下面的code,但我不知道如何指定的语言。

我该怎么办?

 意向意图=新意图(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_PROMPT,提示); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,100); 

解决方案

我以前从未使用过的RecognizerIntent。但它好像有一个额外的,你可以把选择不同的语言

android 语音识别文字

的http://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_LANGUAGE

我认为,如果你再拍putExtra()调用并将它传递不变,并在适当的形式的字符串(EN-US),将设置语言。

不过,我不知道也看不出到底有多少/支持的语言在那里的任何地方。所以,你可能有有限的成功尝试将它使用不同的语言。

我想这样的事情会做的伎俩:

  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,EN-US); 

您只需要找到你感兴趣的语言bcp47兼容的语言标记。

How do I set the voice recognition language to something that I choose?

For example, is there something that I can set to change the voice recognition language?

I am using the following code, but I do not know how to specify the language.

What can I do?

 Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
 intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
 RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
 intent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt);
 intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 100);

解决方案

I've never used the RecognizerIntent before. But it seems like there is an extra that you can put for selecting a different language

http://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_LANGUAGE

I would think that if you make another putExtra() call and pass it that constant and a string in the proper form ("en-US") it would set the language.

However I don't know and don't see anywhere on there exactly how many / which languages are supported. So you may have limited success trying to have it use different languages.

I would think something like this would do the trick:

intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");

you just need to find the bcp47 compliant language tag for the language you are interested in.

 
精彩推荐
图片推荐