I'm unable to force custom Android TV application to recognise non-default language from voice-input. Same problem are in built-in YouTube application (and other). However it works in built-in Google Search app (Katniss).
There are my code which works well on Nexus phone, but on Nexus Player setting custom language doesn't give any results in selected language.
SpeechRecognizer sr = SpeechRecognizer.createSpeechRecognizer(this);
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"voice.recognition.test");
String loc = "ru-RU";
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, loc);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, loc);
intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, loc);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5);
sr.startListening(intent);
Looks like it was fixed in one of Google Search app updates
Related
i want to improve my knowledge and work with sound reorganization (speech to text). i find good samples from google but i don't know how can i do so with Persian-Farsi language? i do it with English but how about Farsi? is it need some setting in my mobile android phone? is there anyone who do so?
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
startActivityForResult(intent, REQUEST_CODE);
just put new extra in your intent as below
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "fa");
I am looking for a voice recognition library for Android. I only need it to understand "Yes/No" answers ( in different languages - like English, German, French ).
Any suggestions?
Not sure about V-R libraries because the Play Store max App size is 50megs and those voice packages are about 15 to 20 megs each so it will impossible to include multiple languages directly into the App.
There may be an online service to use but you need to search the net for that.
What most people use is the inbuilt Android voice recognition Intent. For different languages should be ok for the ones you want as they are included. However i'm not sure if for example in France when you buy a phone or a tablet the default V-R language will be French and not English, therefore the user will need to go into Language settings and Download the French V-R package.
To start V-R in Android you do
startVoiceRecognitionActivity();
private void startVoiceRecognitionActivity() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName());
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");
startActivityForResult(intent, 1234);
}
//To get the Voice data back as Text string
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
//pull all of the matches
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String topResult = matches.get(0);
}};
The String topResult is the speech in text
I'm implementing speech recognition in my app and have some questions the API doc couldn't solve. I wonder what's the difference between using
Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
and
Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
?
I also recognized that I have to put the EXTRA_LANGUAGE_MODEL also when using ACTION_WEB_SEARCH? Why is that?
And what means EXTRA_WEB_SEARCH_ONLY? I thought that it is always web search with the web search action.
I have successfully added Google Voice Search Activity using following code:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
try {
startActivityForResult(intent, 1);
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(context, "Oops! Your device doesn't support Speech to Text",Toast.LENGTH_SHORT);
t.show();
}
I searched in "en-US" and its worked perfectly but sometimes it is searching like english of German or other countries and returning Pure ENGLISH WORDS. and not recognize my language.
Is there any SETTINGS that makes my search better.
Your help would be appreciated.
I am trying to do a browser control appication with voice in android. I am using RecognizerIntent.ACTION_RECOGNIZE_SPEECH intent to recognize voice. It usually works but sometimes when voice recognition pop up opens and comes with "unknown problem" and my WebView don't load my URL, stays with old URL.
Here is my code:
//Load web view to default search screen
webView.loadUrl(Constant.DEFAULT_VOICE_BG);
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.ACTION_RECOGNIZE_SPEECH, getClass()
.getPackage().getName());
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
GeneralConstants.TEXT_VOICE);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5);
startActivityForResult(intent,
GeneralConstants.VOICE_RECOGNITION_REQUEST_CODE);
Thanks for any idea.
Best Regards.