I'm working on an android app which takes voice input and sets the result text into a TextView. Though the language of the speech to be recognized is not English, the result text the app is providing is English. To put it in an elaborate way, the speech recognition intent I am creating is like this:
Locale locale = new Locale.Builder().setLanguage("bn").setScript("Beng").setRegion("BD").build();
intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,locale);
intent.putExtra(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES,locale);
intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE,locale);
And the RecognitionListener onResult() method looks like this:
public void onResults(Bundle results) {
ArrayList<String> voiceResults = results
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if (voiceResults == null) {
text = "";
Log.e("Listener","No voice results");
} else {
text = voiceResults.get(0);
display.setText(text);
}
}
I want the results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION) to return an ArrayList consisting of Bengali letters.
The Expected behavior:
Current output:

