How could I change the time before the speech result is closed CMUSphinx4

44 views Asked by At

I want to change the time before the speechresult is closed.

For example, If I say "Hello", and then wait a second before saying "Hi", they will be 2 separate speech results. If I say one right after the other, it works fine. I want sphinx to not stop the speechresult until 3 seconds of no speech go by.

I tried using a thread with a countdown, and appending speechresult.getHypothesis() until the countdown got to 0 (and there was still no text), but it was not working.

P.S: Sorry for my lack of code, I just used the default code here: https://cmusphinx.github.io/wiki/tutorialsphinx4/

(Java CMU Sphinx 4 version pre-alpha 5)

Thanks so much for the help!

1

There are 1 answers

0
Delected On

found a nicer solution...

        do {
            speechResult = speech.getResult();
            totalResult.append(speechResult.getHypothesis()).append(" ");

        } while (!speechResult.getHypothesis().toLowerCase().replaceAll("[^a-zA-Z0-9]", "").equals(""));

again, if you have something better, please post it

EDIT: totalResult is a speech builder, and speech is LiveSpeechRecognition