Android - Voice recognition - android

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

Related

Persian speech to text in android

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

Non-default language for voice recognition in Android TV

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

Android Google Voice Search changed language automatically sometimes

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.

Using a Tesseract-based OCR via Intent

I need my app to read text via Camera. I know there's the Tesseract library which does this, but I'd really prefer if there was an app that can handle Intents to read text via Camera, like Xzing does for reading QR codes.
Is there such an app?
There isn't currently an app on Google Play that does this.
I've thought about making one, but the possible use cases for such an app vary much more than for, say, scanning a QR code. There are different possible scenarios:
License plate recognition
Recognition for LCD 7-segment displays
Korean OCR
OCR for stylized text
OCR with shadows or uneven illumination
The different scenarios present a challenge for how to handle the image. A request to such an app via Intent would probably need to specify at least the type of thresholding to use for pre-processing the image along with the language/traineddata file to use.
I've just created an app that takes a photo using the Camera, crop the photo, and return the recognized text as result.
In your app, you may use the following code:
PackageManager pm = getPackageManager();
try {
pm.getPackageInfo("sunbulmh.ocr", PackageManager.GET_ACTIVITIES);
Intent LaunchIntent = pm.getLaunchIntentForPackage("sunbulmh.ocr");
LaunchIntent.setFlags(0);
startActivityForResult(LaunchIntent,5);
} catch (NameNotFoundException e) {
Uri URLURI = Uri.parse("http://play.google.com/store/apps/details?id=sunbulmh.ocr");
Intent intent = new Intent(Intent.ACTION_VIEW,URLURI);
startActivity(intent);
}
Then, get the result in onActivityResult():
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if(requestCode == 5){
String ocr_txt = data.getStringExtra(Intent.EXTRA_TEXT);
// ocr_txt contains the recognized text.
}
}
}

How to use google speech api in android

I have to develop an android application in which user speaks something and the wav file os send to the server where the googlespeech api shall return some text and i will display it on the android activity screen.
Note : Dont confuse urself with the android Text To Speech library i have to send the wav file
to the client's server.
Problem : I have no idea of howsoever to use this API. I can record the voice from the client and save it in a wav file but don't know how to proceed.
Refer Link : http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/
You actually can't record a wav file and use it. At this moment the only way to do it is to get voice from the microphone using android intent:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-EN");
startActivityForResult(intent, CODE);
And then you can recievie the result in onActvityResult function:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
List<String> matches = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS);
}
That is the basic idea.

Categories

Resources