I'm working on an android app, that offers continuous Speech Recognition.
Everything works fine except the silence delay after last word pronounced which is around 6 seconds.
I have seen that it's a known bug in Android, but is there any alternatives / hacks / workaround for this ?
Intent intent = new Intent (RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault ());
intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
intent.putExtra (RecognizerIntent.EXTRA_CONFIDENCE_SCORES, true);
intent.putExtra (RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 0);
intent.putExtra (RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 0);
intent.putExtra (RecognizerIntent.EXTRA_CALLING_PACKAGE, getApplication ().getPackageName ());
speechRecognizer.startListening (intent);
So basically RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
is not taken into consideration at all.
Is there any way to solve this ? or an alternative API ? (I have used PocketSphinx but couldn't make it work for sentences and words outside the dictionary).
答案 0 :(得分:0)
I suggest trying this:
mNoSpeechCountDown = new CountDownTimer(COUNT, COUNT) {
@Override
public void onTick(long l) {
}
@Override
public void onFinish() {
Log.v(TAG, "CountDown Finished");
processResults(mResult + ' ' + mPartialResult);
mListener.restartListener();
}
};
mNoSpeechCountDown.start();
}
and restarting the countdown on every onPartial of course this requires you to implement your own RecognitionListener.
ContinuousRecognizer implements RecognitionListener
08-13 15:50:22.680 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.680 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.689 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.689 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.765 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.765 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.833 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.833 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.970 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.970 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime
08-13 15:50:23.155 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.155 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime
08-13 15:50:23.327 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.327 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime
08-13 15:50:23.412 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.412 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series
08-13 15:50:23.734 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.734 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:23.953 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.953 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:24.523 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:24.523 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I want me Direct
08-13 15:50:24.754 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:24.754 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:25.350 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:25.351 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I will
08-13 15:50:25.505 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:25.505 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:25.835 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:25.837 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:26.046 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:26.047 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I want you to
08-13 15:50:26.365 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:26.365 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I want you to direct
08-13 15:50:30.865 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: CountDown Finished