Android : android pocketshpinx "word %s missing in dictionary" errors

on Sunday, April 19, 2015


I'm trying to test some basic keyword recognition in a Fragment using this pocket sphinx android library. I've got the project jar set up and correctly added as a dependency, I've added the .so files to the jniLibs folder as instructed in this tutorial http://cmusphinx.sourceforge.net/wiki/tutorialandroid


Everything seems to work fine as far as the other searches(digits, etc)..But for some reason I can't get keyword search to work. I'm getting a crash with a very clear and explicit error message. It's basically saying that a bunch of words aren't found in the dictionary.



enter code here 6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary


04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'EH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'SH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'Z' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'SH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'ZH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'ZH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'ZH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'ZH' is missing in the dictionary 04-19 14:35:59.930 6086-6107/? E/cmusphinx﹕ ERROR: "kws_search.c", line 165: The word 'SH' is missing in the dictionary


I'm using the dictionary that comes packaged with the library, the "cmu-en-us.dict", which in fact doesn't seem to have these capitalized words included at all.


So then I searched around and found this one http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b


When I added that to the project, and tried to reference that dictionary instead. I got the same errors as before, but now saying that the words in the previous dictionary I was using(cmu-en-us.dict) was missing.


I'm not sure what I'm doing wrong. But I just followed the set up tutorial and also used the code from the demo project's Activity here https://github.com/cmusphinx/pocketsphinx-android-demo/blob/master/app/src/main/java/edu/cmu/pocketsphinx/demo/PocketSphinxActivity.java


Oh, and here's how I'm setting up my SpeechRecognizer



private void setupRecognizer(File assetsDir) throws IOException {
// The recognizer can be configured to perform multiple searches
// of different kind and switch between them
Log.d("RecipeSearchFragment", "setupRecognizer");
mRecognizer = defaultSetup()
.setAcousticModel(new File(assetsDir, "en-us-ptm"))
.setDictionary(new File(assetsDir, "cmudict-en-us.dict"))


// To disable logging of raw audio comment out this call (takes a lot of space on the device)
.setRawLogDir(assetsDir)

// Threshold to tune for keyphrase to balance between false alarms and misses
.setKeywordThreshold(1e-45f)

// Use context-independent phonetic search, context-dependent is too slow for mobile
.setBoolean("-allphone_ci", true)

.getRecognizer();
mRecognizer.addListener(this);

/** In your application you might not need to add all those searches.
* They are added here for demonstration. You can leave just one.
*/


mRecognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "cmudict-en-us.dict"));

mRecognizer.startListening(KWS_SEARCH);

}


Anyone else ever run into this? What am I doing wrong here?


0 comments:

Post a Comment