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

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

  •  09-10-2022
  •  | 
  •  

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");
有帮助吗?

解决方案

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");  

其他提示

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");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top