I am Currently working on a project to implement offline continuous speech recognition using pocketsphinx. I have developed it to the point where it recognizes the keyword I say, however the hypothesis in onPartialResults()
and onResults()
is not cleared and the words keep appending to the string. Therefore the code ahead keeps getting called infinitely.
Using hypothesis.setHypstr("");
or hypothesis.delete();
doesn't do anything.
I want it to wait in the background, whenever I say the keyword, it runs the code and wait in the background again.
To clear hypothesis you need to stop recognizer and start listening again:
recognizer.cancel()
recognizer.startListening(searchName)
Check the code here for example