Restrict Speech Recognition to one language only - android

I have one query About Android Speech Recognition.
I want to restrict a speech recognizer to recognize only given/selected language.
For example, if I select "en" as preferred language, speech recognizer should only return English words after Speech to text conversion. And should ignore other languages words like,
If I say "Hola" or "Bonjour", it should return null or should not recognize the word, or no response, etc
I did try EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, but no success.
Also, all other links are about how to add multiple languages, but I want opposite of it, I want single language to be recognized by the speech recognizer.
If there is any workaround or if there is some specific way to use EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, kindly do share here.

Related

Sl4a recognize speech in background

I am started programming sl4a (in QPython) and it is really great. Now I tried to use the droid.recognizeSpeech function. This one works fine too, but I like to get it in the background listening for a keyword, like Google's 'OK Google'.
So I looked around, but cannot find anything. I don't know how I can implement it.
So I ask you, can someone tell me, if it is possible, how to make recognize speech always listening in the background waiting for a keyword?
I've toyed with the idea of doing this, but never found any useful practical application for it. So here's a summary of my research, I hope it's enough to get you started:
1. The Speech Recognizer facade has multiple parameters. Usually, everyone puts "none" in all of them except the first. Here's the facade in it's actuality:
recognizeSpeech:
Recognizes user's speech and returns the most likely result.
prompt (String) text prompt to show to the user when asking them to speak (optional)
language (String) language override to inform the recognizer that it should expect speech in a language different than the one set in the java.util.Locale.getDefault() (optional)
languageModel (String) informs the recognizer which speech model to prefer (see android.speech.RecognizeIntent) (optional)
returns: (String) An empty string in case the speech cannot be recognized.
So you're looking for the languageModel in this case, that option is restricted to two types. A web search model and a free-form speech model. You're looking for the free-form speech model in this case. Here's a little more info on this model from the horse's mouth:
Google on the Free-Form Language Model
Once you've looked at the free-form speech model, what should help you is Chrome's continuous speech recognition model, which should share a lot of the same characteristics of the Free-Form language model. Hope this helps set you on the right direction

Android App- speech to text in Indian English

I am developing an Android App that uses speech to text recognition.I have used RecognizerIntent and i know about the link
http://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_LANGUAGE
But this allows US-english. I want the speech recognizer to recognize Indian Englishas i need the App to recognize Indian names. Is it possible?
As the linked document says, the value is a "IETF language tag (as defined by BCP 47)". Which values are actually supported depends on the speech recognizer that you are using. E.g. Google's recognizer supports en-IN, so if you are using Google's recognizer then you could try to set the value of EXTRA_LANGUAGE to en-IN and test if Indian names will be recognized.

How to feed speech recognizer the list of words to look into

Is there any way to tell android's speech recognizer to catch the words only from the contacts list or any predefined list? For example: I want the user to speak a name and rather than looking the useless words, speech recognizer try to find the match from the contacts list.
Look up Grammar Lists that is what you are referring to. Some speech recognition software automatically supports it. Another solution would be that certain speech recognition software will provide a list of possibile interpretations and you can match a grammar list to the return results. Look up the speech recognition API and match it with an array of the names you want it to compare against.

Special characters in speech recognition

I am wondering if there is a way to recognize special characters (#, -, ., _) with Android SpeechRecognizer?
Android's speech recognizer (i.e. the interfaces and classes in android.speech) return strings. Some of these strings (or their substrings) might be equivalent to e.g. # but you have no way of demanding that (e.g. by settings extras). Your best option is to observe how your favorite speech recognizer works and, assuming that it (always) maps the sound /at sign/ to the phrase "at sign", remap it to # in your application.

Android: Speech Recognition Append Dictionary?

I'm using the Speech Recognizer Intent in Android. Is there a way to add your own customized words or phrases to Android's Speech recognition 'dictionary'
No. You can only use the two language models supported.
The built in speech recognition provided by google only supports the dictation and search language models. See http://developer.android.com/reference/android/speech/RecognizerIntent.html and LANGUAGE_MODEL_FREE_FORM or LANGUAGE_MODEL_WEB_SEARCH.
http://developer.android.com/resources/articles/speech-input.html says:
You can make sure your users have the
best experience possible by requesting
the appropriate language model:
free_form for dictation, or web_search
for shorter, search-like phrases. We
developed the "free form" model to
improve dictation accuracy for the
voice keyboard, while the "web search"
model is used when users want to
search by voice
Michael is correct, you cannot change the Language Model.
However, you can use "sounds like" algorithms to process the results from Android and match words it doesn't know.
See my answer here:
speech recognition reduce possible search results

Categories

Resources