android - 电话 'MA' 在声学模型中丢失;单词 'masoud' - pocketsphinx

标签 android python pocketsphinx pocketsphinx-android

我的名字是masoud。 现在我想当我说 masoud 时,我的应用程序会打印控制台日志。

为此,我创建了一个 mdic.txt 文件,并将我的名字放入其中:

masoud MA S O D

我将 mdic.txt 更改为 mdic.dict 并将其放在 assets/sync 目录中。

我做了一个 cm.txt 文件,我在里面放了一个字符串:

#JSGF V1.0;
/**
 * JSGF Grammar for Hello World example
 */
grammar masoud;
public <greet> = (good morning | masoud) ( bhiksha | evandro | paul | philip | rita | will );

然后我将 cm.txt 更改为 cm.gram

在我的 MainActivity 中

private void setupRecognizer(File assetsDir) throws IOException {
    // The recognizer can be configured to perform multiple searches
    // of different kind and switch between them

    recognizer = SpeechRecognizerSetup.defaultSetup()
            .setAcousticModel(new File(assetsDir, "en-us-ptm"))
            //.setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
            .setDictionary(new File(assetsDir, "mdic.dict"))
            //.setRawLogDir(assetsDir) // To disable logging of raw audio comment out this call (takes a lot of space on the device)
            .setKeywordThreshold(1e-45f) // Threshold to tune for keyphrase to balance between false alarms and misses
            .setBoolean("-allphone_ci", true)  // Use context-independent phonetic search, context-dependent is too slow for mobile


            .getRecognizer();
    recognizer.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.
     */

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

    recognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "mdic.dict"));

现在我收到这条消息:

"dict.c", line 195: Line 1: Phone 'MA' is mising in the acoustic model; word 'masoud' ignored "kws_search.c", line 171: The word 'masoud' is missing in the dictionary

我在 recognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "mdic.dict")); 行遇到了这个错误。

最佳答案

masoud 的正确转录是“M AH S UW D”。

声学模型中没有电话 MA。错误说明了这一点。

关于android - 电话 'MA' 在声学模型中丢失;单词 'masoud' - pocketsphinx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39520456/

相关文章:

java - Android Studio 无法识别 "task.isSuccesful"( "Cannot resolve symbol ' 任务 ' ")

java - Android studio 3.0.1使用库时无法合并dex?

ios - TLSphinx cmusphinx pocketsphinx 假设结果文本 空字符串 得分 负 (-) 数字

python - windows 上的 pocketsphinx 安装错误

android - 在 Canvas 上绘制文本

android - 无法在 Android Studio 中启动新项目,没有任何反应

python - 检查用户输入和具有多个值的字典键之间的匹配

python - 如何更优雅地将一对键值对的字典解包为两个变量?

python - 还有另一种方法可以将字典的相同 for 循环迭代到无限吗?

python - 尝试在 Raspberry pi 上运行 PocketSphinx 时,新解码器返回 -1