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


Java Configuration类代码示例

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


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

示例1: onStart

import edu.cmu.sphinx.api.Configuration; //导入依赖的package包/类
@Override
public void onStart() throws PluginStartupException {
    this.setPollingWait(-1); // Disable onRun loop execution
    Configuration sphinxConfiguration = new Configuration();
    // Load model from the jar
    // Set path to acoustic model
    sphinxConfiguration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
    // Set path to dictionary
    sphinxConfiguration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
    // Set language model
    sphinxConfiguration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");
    try {
        recognizer = new LiveSpeechRecognizer(sphinxConfiguration);
        // Start recognition process pruning previously cached data.
        recognizer.startRecognition(true);
    } catch (IOException ex) {
        throw new PluginStartupException("Cannot listen from microphone", ex);
    }

    setDescription("Ready, try saying 'turn on kitchen light'");
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:22,代码来源:SpeechRecognition.java

示例2: 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

示例3: 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

示例4: AudioTranscriber

import edu.cmu.sphinx.api.Configuration; //导入依赖的package包/类
/**
 * Constructs an AudioTranscriber object
 * */
public AudioTranscriber()
{
    this.config = new Configuration();
    config.setAcousticModelPath(SphinxConstants.ACOUSTIC_MODEL_EN_US);
    config.setDictionaryPath(SphinxConstants.DICTIONARY_EN_US);
    config.setLanguageModelPath(SphinxConstants.LANGUAGE_MODEL_EN_US);
}
 
开发者ID:jitsi,项目名称:Sphinx4-HTTP-server,代码行数:11,代码来源:AudioTranscriber.java

示例5: getConfiguration

import edu.cmu.sphinx.api.Configuration; //导入依赖的package包/类
/**
    * 
    * @return Returns the initialized {@link Configuration} to {@link SpeechToTextEngine}
    */

   protected Configuration getConfiguration() {
Configuration configuration = new Configuration();
       
   	configuration.setAcousticModelPath(getAcousticModelLocation().toString());           
       //configuration.setAcousticModelPath("/tmp/model/acoustic");
       configuration.setDictionaryPath(getDictionaryModelLocation().toString());
       //configuration.setDictionaryPath("/tmp/model/en-cmu.dict");
       configuration.setLanguageModelPath(getLanguageModelLocation().toString());
       // configuration.setLanguageModelPath("/tmp/model/en-us.lm.dmp");
       return configuration;
   }
 
开发者ID:sumansaurabh,项目名称:SpeechToTextEngine,代码行数:17,代码来源:SphinxConfig.java


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