本文介绍了n最佳的pocketsphinx Android的支持!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我需要在Android的pocketsphinx n个最好的支持的研究项目。我使用痛饮命令行工具来生成pocketsphinx_wrap.c,然后NDK的构建产生针对Android共享库。唯一的问题是写在pocketsphinx.i需要n个最好的内容。任何一个可以请告知或引导我如何写pocketsphinx.i功能?

I have a research project in which i need n-best support in pocketsphinx android. I am using swig command line tool to generate pocketsphinx_wrap.c , and then NDK-build to generate shared library for android. The only problem is writing n-best content required in the pocketsphinx.i. Can any one please advise or guide me how to write function in pocketsphinx.i?

推荐答案

您不写函数,但你写的包装,这是一个非常不同的事情。我们已经与你在论坛主题在这里讨论:

You don't write the function but you write wrapper, it's a very different thing. We already discussed with you that in the forum thread here:

该包装应该是这样的:

typedef struct ps_nbest_s NBest;

typedef struct ps_nbest_t {
} Nbest;

%extend Nbest {
    Nbest(Decoder *d) {
        Nbest *nbest = ps_nbest(d, 0, -1, NULL, NULL);
        return nbest;
    }
    ~Nbest() {
        ps_nbest_free($self);
    }

    void next() {
        ps_nbest_next($self);
    }

    Hypothesis* hyp() {
        const char* hyp;
        int32 score;
        hyp = ps_nbest_hyp($self, &score);
        return new_Hypothesis(hyp, "", score);
    }
};

这篇关于n最佳的pocketsphinx Android的支持!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 13:30