个别关键短语的分裂假设 [英] Split hypothesis on individual keyphrases

查看:163
本文介绍了个别关键短语的分裂假设的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android应用中使用Pocketsphinx.我只有相对较小的一组命令可以独立识别,因此最终我使用了从文件中搜索关键字的方式,如下所示:

I use Pocketsphinx in my Android app. I have a relatively small set of commands to be recognized independently, so I ended up using a keyword search from a file that looks like this:

one/1.0/
done/1.0/
recognition on/1e-10/
recognition off/1e-10/

实际列表不是英语的,因此为示例起见,可以任意选择这些关键字.我意识到这些阈值可能不是最佳阈值,而且简短的单词容易出现不匹配的情况.

The actual list is not in English so these keywords are chosen arbitrarily for the sake of the example. I realize that these thresholds may be somewhat less than optimal, and that short words are prone to mismatches.

此方法出现问题:

@Override
public void onPartialResult(Hypothesis hypothesis) {
    if (hypothesis != null) {
        Log.d(
                "Sphinx",
                "\"" + hypothesis.getHypstr() + "\" recognized"
        );
    }
}

请注意,有些单词听起来很相似.事情是

Note that some words sound pretty much alike. The thing is,

  • 一个"导致完成一个"被识别
  • 完成"导致已完成"被识别

不幸的是,我在 hypstr_get 上找不到任何文档(如果能直接引导我,我将不胜感激),但实际上,它似乎以概率增加的顺序返回了可能匹配的字符串

Unfortunately, I couldn't find any documentation on hypstr_get (I would appreciate if you could direct me to it) but effectively it seems to return a joined string of probable matches in increasing order of probability.

如何从假设中检索实际命令?我不能只将 hypothesis.getHypstr()用空格分开,因为某些命令是关键字而不是关键字.我只想要一个最可能的结果.

How can I retrieve actual commands from hypothesis? I can't just split hypothesis.getHypstr() by whitespace since some commands are keyphrases rather than keywords. I only want a single, most probable result.

谢谢.

推荐答案

您可以迭代细分,每个细分都是关键字

You can iterate over segments, each would be a keyword

    for (Segment seg : recognizer.getDecoder().seg()) {
        System.out.println(seg.getWord() + " " + seg.getProb());
    }

这篇关于个别关键短语的分裂假设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆