Programmatically changing recognizerintent to recognize a language other than English not working

StackOverflow https://stackoverflow.com/questions/21667938

  •  09-10-2022
  •  | 
  •  

Pregunta

I tried both of these ways and the google voice web search is still only recognizing English.

Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "ja-JP");
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "ja-JP");
¿Fue útil?

Solución

Try

Intent i = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "ja-JP");  

Otros consejos

Try

String lang_code = "ja-JP";

Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, lang_code);
i.putExtra(RecognizerIntent.EXTRA_PROMPT,"Hi speak something");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top