2
votes

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.

1
Why do you ask exactly the same question as already exists? - Nikolay Shmyrev
Because that question doesn't have an answer. - Brad Kriel
You could just upvote the original question - Nikolay Shmyrev
I don't have the reputation to up-vote, so I asked the same question. The other question was asked a year ago, and it doesn't even have any comments. - Brad Kriel
I have yet to find any evidence that this behavior is not simply a limitation of the Android speech recognition API. I switched recognition engines to CMU Sphinx (cmusphinx.sourceforge.net). It's not as simple to use, but it's not too bad. CMU Sphinx is very configurable, and, after a little acoustic model adaptation, I was eventually able to get better recognition results for my simple command-and-control app with CMU Sphinx than I had with the Android API. - Brad Kriel

1 Answers

0
votes

try to set MAX_RESULTS to 5,10,20 or whatever to see if it helps.