I am studying the source code of TestPocketSphinxAndAndroidASR.java and the first thing that is not so clear to me is how the system knows which recognizer (i.e. Google or CMUSphinx) to invoke.
I can see that the recognition activity is started by:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
but as far as I know this code isn't specific to either GVR (Google Voice Search) or CMUSphinx.
So how does Android know which recognizer to start?
Earlier in onCreate(), there is a reference to an AndroidPocketSphinx setting:
mUsePocektSphinxASR = prefs.getBoolean(PreferenceConstants.PREFERENCE_USE_POCKETSPHINX_ASR, false);
but searching on the entire project yields only the next statement which uses this boolean to display a different Toast:
if (mUsePocektSphinxASR){
Toast.makeText(TestPocketSphinxAndAndroidASR.this, "Would be working offline, using PocketSphinx Speech recognizer...", Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(TestPocketSphinxAndAndroidASR.this, "Working online, Using system speech recognizer (Google speech recognition server)... ", Toast.LENGTH_LONG).show();
}
So I don't understand how the system knows (based on that preference) which recognizer to start.
How does Android know which recognizer to start?
TestPocketSphinxAndAndroidASR.java
? Please provide a link. – Shiff