In my application I am trying to create a speech recognizer from text to speech google Api for turkish and passing EXTRA_LANGUAGE_PREFERENCE
as "tr_TR" to recognize and return result in Turkish but its recognizing in English but not in Turkish.
String lang_code="tr_TR";
recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE,
lang_code);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, lang_code);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
this.getPackageName());
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
recognizerIntent.putExtra(RecognizerInt
ent.EXTRA_MAX_RESULTS, 3);
I fixed that problem in my code:
language = "tr-TR";
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, language);
intent.putExtra(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES, language);
intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, language);
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, language);
intent.putExtra(RecognizerIntent.EXTRA_RESULTS, language);
startActivityForResult(intent, REQUEST_CODE);