I'm using the SpeechRecognizer with minSDK 14 and added a filter to get the most accurate result. This code I have in onActivityResult() of my Activity.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == VOICE_RECOGNITION && resultCode == RESULT_OK) {
ArrayList<String> results = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
// this is only available in API 14
String confidenceExtra = RecognizerIntent.EXTRA_CONFIDENCE_SCORES;
float[] confidence = data.getFloatArrayExtra(confidenceExtra);
// My filtering...
}
}
Because the filtering is based on the confidence of every result I need this constant RecognizerIntent.EXTRA_CONFIDENCE_SCORES
to be able to request the confidence. But sadly this is only available in API 14++ and AFAIK the SpeechRecognition is not available in the Support Package.
Is there a way to get the confidence for the results in lower API Levels? Or is there a work around to do some filtering based on other values?