I'm trying to use Android's speech recognition API offline, exactly like this question Android Offline Speech Recognition shows only one result?. I'm also getting five results when online and only one result offline, and would like to get five(ish) results in either case. Is this simply a limitation of Android's built-in speech recognition engine, or is there some hidden setting that can be changed to force more than one result?
Here's my Intent setup:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); //< have tried both FREE_FORM and WEB_SEARCH
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getPackageName());
intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");
mRecognizer.startListening(intent);
And my onResults():
@Override
public void onResults(Bundle results) {
// data.size() is 1, if running offline and generally 5, if online
ArrayList<String> data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
//...
}
I'm running Android 4.4.2.