android - AndroidPocketSphinx: How does the system know which recognizer is invoked? -


i studying source code of testpocketsphinxandandroidasr.java , first thing not clear me how system knows which recognizer (i.e. google or cmusphinx) invoke.

i can see recognition activity 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 far know code isn't specific either gvr (google voice search) or cmusphinx.

so how android know which recognizer start?

earlier in oncreate(), there reference androidpocketsphinx setting:

musepocektsphinxasr = prefs.getboolean(preferenceconstants.preference_use_pocketsphinx_asr, false); 

but searching on entire project yields next statement uses boolean display different toast:

if (musepocektsphinxasr){   toast.maketext(testpocketsphinxandandroidasr.this, "would 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 don't understand how system knows (based on preference) recognizer start.

how android know which recognizer start?

your question not specific speech recognition on android. it's question how intent resolution happens on android.

your code constructs intent , passes startactivityforresult starts corresponding activity. if there several corresponding activities android pops choice dialog, or chooses automatically based on user-set default. if e.g. google voice search automatically chosen can try apply "clear defaults" in application manager. instructions samsung galaxy s ii running android 4.1:

settings -> application manager -> -> google search (v2.7.9...)     -> launch default -> clear defaults 

the google search "launch default" setting should show "no defaults set". now, if launch activity supports action_recognize_speech , if in addition google search have 1 or more apps installed support intent, you'll see dialog. if testing need app supports action_recognize_speech install kõnele. (i'm not sure cmu sphinx based code reference implements intent type, didn't check carefully.)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -