How to increase the amount of time to consider inp

2019-04-13 17:51发布

In android voice recognition, Can any one know how to increase the amount of time that it should take after we stop hearing speech to consider the input possibly complete. I need to prevent the endpointer cutting off during very short mid-speech pauses while voice recognition. If anyone knows the solution, please give reply. Any response would be appreciated.

thanks in advance

3条回答
冷血范
2楼-- · 2019-04-13 18:11

These two parameters are relevant and they control the amount of silence the recognizer needs to hear before stopping.

EXTRA_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS or EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

They both seem to control the same thing and which ever is lower is the one it uses.

For example, if complete_silence = 20000 and possibly = 10000 then the recognizer will stop after it hears 10000 milliseconds of silence.

查看更多
你好瞎i
3楼-- · 2019-04-13 18:22

Hi Im also having this problem, but I found something,

here's my code

private void startVoiceRecognitionActivity()   
    {   

        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);   

        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);   
//        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 2000000);   
//        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 2000000);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 20000000);

        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "XXXXXXX");   

        startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);   
    }

in google API I found the 3 extra to change the time issue, but none of them seems to work, u can also try to test them.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-04-13 18:31
String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS   The amount of time that it should take after we stop hearing speech to consider the input complete.
 String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS    The minimum length of an utterance.
 String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS  The amount of time that it should take after we stop hearing speech to consider the input possibly complete.

These parameters stopped working for Jelly Bean devices. They still work for ICS devices and below.

查看更多
登录 后发表回答