When doing speech recognition using Google's server's via Chrome's HTML 5 speech input support, you get back roughly 6 results each time that are the 6 possible interpretations of the user's voice audio. When I do the same operation in my Android app, I only seem to get back one. Is this just the way it is or is there a setting that will cause the Android recognizer intent to return more than one utterance?
Relevant code samples:
/**
* Fire an intent to start the voice recognition activity.
*/
private void startVoiceRecognitionActivity()
{
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech reco demo...");
startActivityForResult(intent, REQUEST_CODE);
}
/**
* Handle the results from the voice recognition activity.
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK)
{
// Set the current global speech results to this latest session's.
ArrayList<String> matches = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS);
AndroidApplication andApp = AndroidApplication.getInstance();
andApp.speechRecoResults.setContents(matches);
}
super.onActivityResult(requestCode, resultCode, data);
} // onActivityResult()
UPDATE: I added the following line of code to startVoiceRecognitionActivity() as per |Z|Shadow|Z| right before the startActivityForResult() call and I get multiple utterances now:
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5);
-- roschler