2015-10-20 48 views
-4

我正在考慮在應用中使用Android的語音識別,但我沒有使用語音識別的先前經驗,因此我對任何事情都沒有絲毫的線索。因此,我有幾個問題,我想嘗試任何事情之前要問...Android語音識別。可能性?可靠?

用戶會說行,看起來像這樣:

[Sport][1-20][ScoringSystem] 

對於每個支架,會有列表可接受的詞。該列表應該存儲在本地。因此,這將是工作的例子:

Soccer 5 goals 

Dart 10 points 

非工作將是什麼,從這個模式偏離,或者說是不是在列表中。例如;

5 Soccer Goals 

Alienball, 4 gammahoops 

1)這是可能的嗎?

2)如果可能,完成是非常困難/複雜嗎?

3)除了Android自己的API之外,有沒有推薦使用的API來完成我想要做的事情?

+1

如果你們只是要把這個問題投下來,至少爲什麼... – optional

+0

你的問題的密切投票說「太廣泛」。你的問題至少有問題。也許這是爲什麼? (我沒有DV) – ashes999

+0

好吧,現在我已經刪除了幾個問題。現在有3個問題,都是非常密切相關的。 – optional

回答

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); 
      }