How to only detect keywords with continuous recognition for Sphinx4 in Java desktop application?

176 Views Asked by At

I am new to Sphinx and I have read about the various examples used across the multiple programming languages that allows for continuous voice recognition. I am trying to figure out the best way to do "keyword spotting" using Sphinx4 (5prealpha) with continuous listening in a Java desktop application. In python, it seems fairly easy and PocketSphinx has a continuous mode that would work, however I am trying to make this work with my Java desktop application.

I have read a few articles about doing this in Android, however the method it uses is not available in the Sphinx4 core library (atleast it won't work for me).

recognizer.addKeyphraseSearch(KWS_SEARCH, KEYPHRASE);

Perhaps switch over to PocketSphinx? It is my understanding that PocketSphinx is meant for mobile devices and machines that require less resources. This is not really a limitation for me. All I want is for my application to detect a pre-selected keyword as fast as possible.

My current code works, however it is very basic and takes a very long time to recognize words (>15 seconds) and just seems inefficient:

    Configuration configuration = new Configuration();

    String path = "file:C:\\path\\to\\models\\sphinx\\";
    configuration.setAcousticModelPath(path + "en-us");
    configuration.setDictionaryPath(path + "cmudict-en-us.dict");
    configuration.setLanguageModelPath(path + "en-us.lm.bin");

    LiveSpeechRecognizer recognizer = new    LiveSpeechRecognizer(configuration);

    recognizer.startRecognition(true); 
    while (true) {
      SpeechResult result = recognizer.getResult();
      //Do stuff with words      
    }
0

There are 0 best solutions below