-4

I'm considering using Android's voice recognition in an app but I have no prior experience in using voice recognition so I don't have the slightest clue about anything. Therefore I have a few question I'd like to ask before attempting anything...

The user will say a line that looks like this:

[Sport][1-20][ScoringSystem]

For each bracket, there will be a list of acceptable words. The list should be stored locally. So this would be working examples:

Soccer 5 goals

or

Dart 10 points

Non working would be something that deviates from this pattern, or that is not in the list. For example;

5 Soccer Goals

or

Alienball, 4 gammahoops

1) Is this possible?

2) If possible, would it be very hard/complex to accomplish?

3) Is there any recommended API's to use, except Android's own api, to accomplish what I want to do?

optional
  • 273
  • 1
  • 5
  • 13
  • 1
    If you guys are just gonna vote the question down, at least post why... – optional Oct 20 '15 at 15:16
  • the close votes on your question say "too broad." You have at least questions in your question. Maybe that's why? (I didn't DV) – ashes999 Oct 20 '15 at 15:39
  • Ok, well now I have removed several questions. There are now 3 questions, all are very closely related. – optional Oct 20 '15 at 20:34
  • questions with low votes rarely make it back into the limelight. Maybe you can do some research and present your findings in your question? SO is more of a directed "here's my very specific question and here's where I'm stuck" kind of place. – ashes999 Oct 20 '15 at 20:47

1 Answers1

0
  Inside your Activity, append this code.


             private static final int REQUEST_CODE = 1234;
             /**
              * Fire an intent to start the voice recognition activity.
              */

              private void startVoiceRecognitionActivity()
              {
                    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo...");
                    startActivityForResult(intent, REQUEST_CODE);
               }


            /**
             * Handle the results from the voice recognition activity.
             */
            @Override
            protected void onActivityResult(int requestCode, int resultCode, Intent data)
            {
                if (requestCode == REQUEST_CODE && resultCode == RESULT_OK)
                {
                    // Populate the wordsList with the String values the recognition engine thought it heard
                    ArrayList<String> recognisedWordsList= data.getStringArrayListExtra(
                            RecognizerIntent.EXTRA_RESULTS);
                    //now, you can do any logics you want with your recognisedWordsList, the first is the most accurate
                }
                super.onActivityResult(requestCode, resultCode, data);
            }
Toukea Tatsi
  • 189
  • 1
  • 5