You can use Pocketsphinx to complete this task. Check out the demo version of Pocketsphinx android , for example, how to efficiently use the keyword offline and respond to certain commands, for example, the keyword phrase "about a powerful computer." The code for this is simple:
you create a recognizer and just add a search for keywords:
recognizer = SpeechRecognizerSetup.defaultSetup() .setAcousticModel(new File(modelsDir, "hmm/en-us-semi")) .setDictionary(new File(modelsDir, "lm/cmu07a.dic")) .setKeywordThreshold(1e-40f) .getRecognizer(); recognizer.addListener(this); recognizer.addKeyphraseSearch("keywordSearch", "oh mighty computer"); recognizer.startListening("keywordSearch);
and identify the listener:
@Override public void onPartialResult(Hypothesis hypothesis) { if (hypothesis == null) return; String text = hypothesis.getHypstr(); if (text.equals(KEYPHRASE)) {
You can adjust the keyword threshold for the best match detection / false positive. For an ideal keyword for definition there should be at least 3 syllables, preferably 4 syllables.
Nikolay Shmyrev Jun 20 '14 at 7:55 a.m. 2014-06-20 07:55
source share