Voice recognition vocabulary limitation for faster matching and good accuracy

I am trying to make an Android application whose part is voice recognition. I have very limited voice commands that the application will work on. Therefore, I want to somehow limit the dictionary or create a new dictionary of words that will be used by the application, so that the application will have very good accuracy and a faster match. E.g. If I say β€œB,” the result may be β€œB,” β€œBe,” or β€œBee,” but my application should only look for β€œB,” not any other similar sound. How to do it in Android?

Edit: I'm new to android, but have still used basic Google voice recognition while reading a tutorial on the net. Seriously, some hints are needed to complete this task, so I won’t spend more time looking for irrelevant things in the future.

+4
source share
2 answers

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 ( ) , , , .

:

/**
 *  in your Activity
 */
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);
            //  TODO:  loop through possible matches, 
            //         and choose what you think is appropriate 
        }
    }
}  

>

+4

All Articles