Android voice recognition will work both offline and online. It's just that when offline, recognition isn't that good, and you don't have multiple outcome options. In on-line mode, Google Voice Recognizer returns an array of possible results along with confidence levels, so if you have:
choice 1: Bee 0.6522 confidence
choice 2: Be 0.1 confidence
choice 3: B 0.0 confidence
Bee ( ) , , , .
:
public void startVoice(View view) {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Go on, say something...");
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 100);
startActivityForResult(intent, 111);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == 111) {
if (resultCode == RESULT_OK)
{
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
float [] scores = data.getFloatArrayExtra(RecognizerIntent.EXTRA_CONFIDENCE_SCORES);
}
}
}
>