我尝试使用这个口袋里的sphinx android库在Fragment中测试一些基本的关键字识别。我已经设置了项目jar并正确添加为依赖项,我已按照本教程中的说明将.so文件添加到jniLibs文件夹中 http://cmusphinx.sourceforge.net/wiki/tutorialandroid
就其他搜索(数字等)而言,一切似乎都能正常工作。但由于某种原因,我无法获得关键字搜索功能。我收到了一个非常清晰明确的错误消息。它基本上是说词典中没有找到一堆词。
04-19 14:35:59.930 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
我正在使用随图书馆打包的词典," cmu-en-us.dict",实际上似乎没有包含这些大写单词所有
然后我四处寻找并找到了这个 http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b
当我将其添加到项目中时,尝试引用该字典。我得到了和以前一样的错误,但是现在说我正在使用的 previous 字典中的单词(cmu-en-us.dict)丢失了。
我不确定我做错了什么。但我只是按照设置教程,也使用了演示项目活动中的代码 https://github.com/cmusphinx/pocketsphinx-android-demo/blob/master/app/src/main/java/edu/cmu/pocketsphinx/demo/PocketSphinxActivity.java
哦,这就是我如何设置我的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);
}
其他人遇到过这种情况?我在这里做错了什么?
答案 0 :(得分:0)
关键字搜索配置了关键短语列表文件。密钥短语列表文件列出每行一个关键短语:
Recognizing multiple keywords using PocketSphinx
您错误地将字典用作以下行中的关键字列表文件:
mRecognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "cmudict-en-us.dict"));
这不是一个好主意。