(Android版)如何设置语音识别语言的东西,我选择? [英] (Android) How do I set the voice recognition language to something that I choose?

查看:228
本文介绍了(Android版)如何设置语音识别语言的东西,我选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我用下面的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。但它好像有一个额外的,你可以把选择不同的语言

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.

这篇关于(Android版)如何设置语音识别语言的东西,我选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆