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:
you just need to find the bcp47 compliant language tag for the language you are interested in.