(Android) 如何将语音识别语言设置为我选择的语言?
如何将语音识别语言设置为我选择的语言?
例如,我可以设置更改语音识别语言吗?
我正在使用以下代码,但我不知道如何指定语言。
我能做些什么?
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);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前从未使用过 RecognizerIntent。但似乎有一个额外的选项可以用来选择不同的语言
http://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_LANGUAGE
我认为如果你再进行一次 putExtra() 调用并传递它常量和正确形式的字符串(“en-US”)它将设置语言。
但是我不知道也没有在任何地方看到到底支持多少种/哪些语言。因此,尝试让它使用不同的语言可能会取得有限的成功。
我认为这样的事情就可以解决问题:
您只需要找到您感兴趣的语言的 bcp47 兼容语言标签。
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:
you just need to find the bcp47 compliant language tag for the language you are interested in.