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


Java Configuration.setGrammarName方法代码示例

本文整理汇总了Java中edu.cmu.sphinx.api.Configuration.setGrammarName方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.setGrammarName方法的具体用法?Java Configuration.setGrammarName怎么用?Java Configuration.setGrammarName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.cmu.sphinx.api.Configuration的用法示例。


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

示例1: initVoice

import edu.cmu.sphinx.api.Configuration; //导入方法依赖的package包/类
public void initVoice(){

        if (config == 0){
            configuration = new Configuration();

            configuration
                    .setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
            configuration
                    .setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
            configuration
                    .setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");
            //set the path to the file "octo.gram"
            configuration.setGrammarPath("file:C:/Users/Marcus/Documents/mthubrepo/PenguinUML"); //Home PC
            configuration.setGrammarName("hello");
            configuration.setUseGrammar(true);
            config = 1;
        }
        else {
            System.out.println("Configuration already done");
        }
        if (mic == 0){
            try{
                voiceGrammar = new LiveSpeechRecognizer(configuration);
                mic = 1;
            }
            catch (Exception e){
                System.out.println(e);

            }
        }
        else {
            System.out.println("Microphone already started");
        }
    }
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:35,代码来源:VoiceController.java

示例2: Hearing

import edu.cmu.sphinx.api.Configuration; //导入方法依赖的package包/类
public Hearing()
{
  try
  {
    // ToDo: Too much chatter with logging enabled. Optionally allow it later.
    Logger logger = LogManager.getLogManager().getLogger("");
    Handler[] handlers = logger.getHandlers();
    logger.setLevel(Level.OFF);

    //ConfigurationManager cm = new ConfigurationManager(url);
    Configuration config = new Configuration();
    config.setAcousticModelPath("resource:/lang/en-us");
    config.setDictionaryPath("resource:/lang/cmudict-en-us.dict");
    config.setLanguageModelPath("resource:/lang/en-us.lm.bin");
    // Comment the below two lines to enable free speech detection (warning: detection is rather poor)
    // Also set setUseGrammar() to false to enable free speech.
    config.setGrammarPath("resource:/lang");
    config.setGrammarName("default");
    config.setUseGrammar(true);
    recognizer = new LiveSpeechRecognizer(config);
  }
  catch(Exception e)
  {
    System.out.println("Unable to provide speech recognition: " + e);
    System.exit(1);
  }
}
 
开发者ID:ldilley,项目名称:frank,代码行数:28,代码来源:Hearing.java


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