当前位置: 首页>>代码示例>>Java>>正文


Java RecognitionListener类代码示例

本文整理汇总了Java中edu.cmu.pocketsphinx.RecognitionListener的典型用法代码示例。如果您正苦于以下问题:Java RecognitionListener类的具体用法?Java RecognitionListener怎么用?Java RecognitionListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RecognitionListener类属于edu.cmu.pocketsphinx包,在下文中一共展示了RecognitionListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FlyteToText

import edu.cmu.pocketsphinx.RecognitionListener; //导入依赖的package包/类
public FlyteToText(final Context context, final RecognitionListener listener) {
    // Start recognizer in a syncTask to avoid freeze
    new AsyncTask<Void, Void, Exception>() {
        @Override
        protected Exception doInBackground(Void... params) {
            try {
                Assets assets = new Assets(context);
                File assetDir = assets.syncAssets();
                setupRecognizer(assetDir, listener);
            } catch (IOException e) {
                return e;
            }
            return null;
        }

        @Override
        protected void onPostExecute(Exception result) {
            if (result != null) {
                Log.e("Sphinx error", result.getMessage());
            }
        }
    }.execute();
}
 
开发者ID:Mighty-Beards,项目名称:Flyting,代码行数:24,代码来源:FlyteToText.java

示例2: execute

import edu.cmu.pocketsphinx.RecognitionListener; //导入依赖的package包/类
@Override
protected void execute(RecognitionListener listener) {
    if (state)
        listener.onBeginningOfSpeech();
    else
        listener.onEndOfSpeech();
}
 
开发者ID:icaksama,项目名称:RapidSphinx,代码行数:8,代码来源:RapidRecognizer.java

示例3: setupRecognizer

import edu.cmu.pocketsphinx.RecognitionListener; //导入依赖的package包/类
private void setupRecognizer(File assetsDir, RecognitionListener listener) throws IOException {
    recognizer = defaultSetup()
            .setAcousticModel(new File(assetsDir, "en-us-ptm"))
            .setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
            .setRawLogDir(assetsDir)
            .setKeywordThreshold(1e-45f)
            .setBoolean("-allphone_ci", true)
            .getRecognizer();
    recognizer.addListener(listener);

    File flyteGrammar = new File(assetsDir, "flyte.gram");
    recognizer.addGrammarSearch("flyte", flyteGrammar);
}
 
开发者ID:Mighty-Beards,项目名称:Flyting,代码行数:14,代码来源:FlyteToText.java

示例4: addRapidListener

import edu.cmu.pocketsphinx.RecognitionListener; //导入依赖的package包/类
/**
 * Adds listener.
 */
protected void addRapidListener(RecognitionListener listener) {
    synchronized (listeners) {
        listeners.add(listener);
    }
}
 
开发者ID:icaksama,项目名称:RapidSphinx,代码行数:9,代码来源:RapidRecognizer.java

示例5: removeRapidListener

import edu.cmu.pocketsphinx.RecognitionListener; //导入依赖的package包/类
/**
 * Removes listener.
 */
protected void removeRapidListener(RecognitionListener listener) {
    synchronized (listeners) {
        listeners.remove(listener);
    }
}
 
开发者ID:icaksama,项目名称:RapidSphinx,代码行数:9,代码来源:RapidRecognizer.java

示例6: run

import edu.cmu.pocketsphinx.RecognitionListener; //导入依赖的package包/类
public void run() {
    RecognitionListener[] emptyArray = new RecognitionListener[0];
    for (RecognitionListener listener : listeners.toArray(emptyArray))
        execute(listener);
}
 
开发者ID:icaksama,项目名称:RapidSphinx,代码行数:6,代码来源:RapidRecognizer.java


注:本文中的edu.cmu.pocketsphinx.RecognitionListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。