0

every time when i run this , it generate result in English. can anyone please help me how can i get results in Arabic.

sr=SpeechRecognizer.createSpeechRecognizer(this);
        sr.setRecognitionListener(this);
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
       /* intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"voice.recognition.test");
        intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5);*/
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "ar-SA");
        intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String[]{});
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "ar-SA");
        intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, "ar-SA");
        sr.startListening(intent);
Toshi Ali
  • 1
  • 1

1 Answers1

1

https://stackoverflow.com/a/26688516/3410197here is your answer.

add your language to the additional language array like-

intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String[]{"ar-SA"});
Community
  • 1
  • 1
Arnav M.
  • 2,590
  • 1
  • 27
  • 44
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/11893695) – Konrad Lindenbach Apr 05 '16 at 04:32
  • @KonradLindenbach that was when i replied from mobile.. i've updated my answer. – Arnav M. Apr 05 '16 at 04:51
  • I have done this but it is generating the same result in default language in English. – Toshi Ali Apr 10 '16 at 12:23