【问题标题】:android pocketshpinx "word %s missing in dictionary" errorsandroid pocketshpinx“字典中缺少单词 %s”错误
【发布时间】:2015-04-19 18:52:29
【问题描述】:

我正在尝试使用这个袖珍 sphinx android 库在片段中测试一些基本的关键字识别。我已设置项目 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)丢失了。

我不确定我做错了什么。但是我只是按照设置教程进行操作,并且还使用了演示项目的 Activity 中的代码 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);

}

还有其他人遇到过这种情况吗?我在这里做错了什么?

【问题讨论】:

    标签: android speech-recognition pocketsphinx-android pocketsphinx


    【解决方案1】:

    关键字搜索配置有关键字列表文件。关键词列表文件每行列出一个关键词:

    Recognizing multiple keywords using PocketSphinx

    您在以下行中错误地将字典用作关键字列表文件:

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

    这不是一个好主意。

    【讨论】:

    • 感谢您的评论!我想我做错了什么。所以基本上我必须用一组预定义的词来配置我自己的关键词列表文件来查找?我认为该库可用于识别动态单词,例如“eggs”或“bird”。至少对于我的用例,我无法提前知道用户会说什么词。我可以用袖珍狮身人面像做到这一点吗?
    • 对我来说,我传递的是小写“ok”,所以它也区分大小写
    猜你喜欢
    • 1970-01-01
    • 2021-01-26
    • 2023-01-01
    • 2011-11-06
    • 1970-01-01
    • 1970-01-01
    • 2013-06-21
    • 2019-07-07
    • 1970-01-01
    相关资源
    最近更新 更多