Nikunj Arora
Nikunj Arora

Reputation: 37

Android Continuous Speech Recognition using pocketsphinx. How to clear hypothesis?

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.

Upvotes: 1

Views: 2019

Answers (1)

Nikolay Shmyrev
Nikolay Shmyrev

Reputation: 25220

To clear hypothesis you need to stop recognizer and start listening again:

   recognizer.cancel()
   recognizer.startListening(searchName)

Check the code here for example

Recognizing multiple keywords using PocketSphinx

Upvotes: 1

Related Questions