edwardffs
edwardffs

Reputation: 432

RecognitionListener: OnPartialResults vs OnResults

In terms of performance and usability, what is the best approach? What are the main differences between these two methods?

I currently have an implementation on "OnResults" that is constantly listening and compares with a couple strings, taking distinct actions for each word detected. However, it fails on recognizing the words some times and sometimes doesn't even listen to anything. If I moved the logic to "OnPartialResults" would improve the usability?

Upvotes: 3

Views: 4495

Answers (1)

Michał Jabłoński
Michał Jabłoński

Reputation: 393

onResults is called when SpeechRecognizer finishes listening. onPartialResults is called when SpeechRecognizer detect new word you have spoken, even before end of listening.

Both of them should have got the same results for single spoken words, but if your speech is longer, onResults can modify your output to make it little more grammatically correct (but just little bit).

Usage of them depends of your purposes. But more accuratrate results are given with onResults.

If you want to match spoken words to action, create own matcher, which would choose the best matching (but not always equal, because it does not work always).

More about onResults and onPartialResults at developer.android.com

Important: to get partial results, you have to add extra to recognizer intent:

intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);

Upvotes: 14

Related Questions