0

我在我的 android 应用程序中实现了 pocketsphinx 来识别语音命令并创建一些自定义字典和单词来识别。这是我的实现:

 private void setupRecognizer(File assetsDir) throws IOException {
    recognizer = defaultSetup()
            .setAcousticModel(new File(assetsDir, "en-us-ptm"))
            .setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
            //.setRawLogDir(assetsDir)
            .setKeywordThreshold(1e-10f)
            .setBoolean("-allphone_ci", true)

            .getRecognizer();
    recognizer.addListener(this);

    // Create keyword-activation search.
    // recognizer.addKeyphraseSearch(KWS_SEARCH, KEYPHRASE);

    File menuGrammar = new File(assetsDir, "target-words.gram");
    recognizer.addKeywordSearch(KWS_SEARCH, menuGrammar);

}

对于单词列表:

yalp /1-0/
yaalp /1-0/
yeelp /1e-1/
yelp /1e-1/

和语法:

yalp Y AE L P
yaalp Y AA L P
yealp Y EH L P
yeelp Y IY L P
yelp Y EH L P

但是我得到了错误的结果,这意味着如果我不说话或不发出声音(即使是在鼓掌),我也会像 Yelp Yealp 等那样获得 PartialResult。我尝试调整 setKeywordThreshold() // 1e-10f, 1e-20f,1e-30f 等,与单词列表相同,以添加不同的范围,如 1-0/1e-1,但没有任何方法可以使其正确。有人可以建议我为什么这会产生错误的结果..

这是我的资产的图像: 在此处输入图像描述

4

0 回答 0