javaandroidspeech-recognitionpocketsphinxpocketsphinx-android

how to use pocketsphinx in android for multiple keyword activation without going to menu


I want pocketsphinx to listen for certain keywords and do respective actions instead of going to the menu like their demo app. I have three keywords

private static final String KEYPHRASE1 = "good morning";
private static final String KEYPHRASE2 = "good evening";
private static final String KEYPHRASE3 = "good night";

This is my onPartialResult()

 @Override
public void onPartialResult(Hypothesis hypothesis) {
    if (hypothesis == null)
        return;

    String text = hypothesis.getHypstr();
   }

I want to call some methods directly when it recognizes the three keywords. I also don't know whether I need to use switchSearch() and KWS_SEARCH like in the demo app. I am new to android and I searched days for the answer. Someone, please help. This speech recognition is necessary for my app.


Solution

  • You have asked two question so I will answer them both in points.