Package edu.cmu.sphinx.util.props

Examples of edu.cmu.sphinx.util.props.ConfigurationManager


import edu.cmu.sphinx.util.props.ConfigurationManager;

public class HarryPotter {

  public static void main(String[] args) {
    ConfigurationManager cm;

    if (args.length > 0) {
      cm = new ConfigurationManager(args[0]);
    } else {
      cm = new ConfigurationManager(HarryPotter.class.getResource("harry.config.xml"));
    }

    final Recognizer recognizer = (Recognizer) cm.lookup("recognizer");
    recognizer.allocate();

    // start the microphone or exit if the programm if this is not possible
    Microphone microphone = (Microphone) cm.lookup("microphone");
    if (!microphone.startRecording()) {
      System.out.println("Cannot start microphone.");
      recognizer.deallocate();
      System.exit(1);
    }
View Full Code Here


  private Microphone microphone;

  private IncantationManager() {
    if (instance != null)
      throw new AssertionError();
    cm = new ConfigurationManager(HarryPotter.class.getResource("harry.config.xml"));
    recognizer = (Recognizer) cm.lookup("recognizer");
    recognizer.allocate();
    microphone = (Microphone) cm.lookup("microphone");
    microphone.startRecording();
  }
View Full Code Here

    }

    @Override
    public void onStart() {
        //setGrammar();
        ConfigurationManager cm;
        cm = new ConfigurationManager(Sphinx.class.getResource("sphinx.config.xml"));
        try {
            recognizer = (Recognizer) cm.lookup("recognizer");
            recognizer.allocate();
        } catch (Exception e) {
            e.printStackTrace();
        }
        // start the microphone or exit if the programm if this is not possible
        Microphone microphone = (Microphone) cm.lookup("microphone");
        if (microphone == null || !microphone.startRecording()) {
            System.out.println("Cannot start microphone. Check if connected.");
            recognizer.deallocate();
        }
        System.out.println("Say: (turn on | turn off) ( kitchen light | livingroom light | light one | light two )");
View Full Code Here

    paramList.add(new String[]{"lookahead", (String)aContext.getConfigParameterValue(paramName[15])});
    paramList.add(new String[]{"logLevel", (String)aContext.getConfigParameterValue(paramName[16])});
   
    //Parametri di configurazione di sphinx4
    ConfigFile = (String) aContext.getConfigParameterValue(CF);
    cm = new ConfigurationManager(ConfigFile);
    for(String[] p: paramList)
      cm.setGlobalProperty(p[0], p[1]);
   
    //Creazione di un nuovo file di log per sphinx4
    sphinxLogger = cm.getRootLogger();
View Full Code Here

      Recognizer recognizer;
     
      //Clone necessario, istanzia un nuovo Configuration Manager per ogni process()
      //in caso di più sphinxAE in esecuzione, le risorse vengono duplicate da quello
      //creato nel metodo inizilize() per non reimpostare tutti i parametri
      ConfigurationManager cm = this.cm.clone();
     
      recognizer = (Recognizer) cm.lookup("recognizer");
     
      List<File> batch = new ArrayList<File>();
      ArrayList<Integer> beginAnnot = new ArrayList<Integer>();
      ArrayList<Integer> endAnnot = new ArrayList<Integer>();
      ArrayList<Long> beginTimeAnnot = new ArrayList<Long>();
      ArrayList<Long> endTimeAnnot = new ArrayList<Long>();
     
      StringBuffer document = new StringBuffer();
      Iterator audioIt = aJCas.getAnnotationIndex(Audio.type).iterator();
      Audio audio = (Audio) audioIt.next();
      Result result;
     
  //    getContext().getLogger().log("CF File is " + ConfigFile);
     
  //    if(audioIt.hasNext())
     
      ConcatAudioFileDataSource data = (ConcatAudioFileDataSource) cm.lookup("dataSource");
     
      for(String i: audio.getAudioPath().toArray())
        batch.add(new File(i));
     
      data.setBatchFiles(batch);
View Full Code Here

    private StreamDataSource audioSource;
    private ConfigurationManager cm;

    public SpeakerIdentification() {
        URL url = getClass().getResource("frontend.config.xml");
        cm = new ConfigurationManager(url);
        audioSource = cm.lookup("streamDataSource");
        frontEnd = cm.lookup(FRONTEND_NAME);
    }
View Full Code Here

     * @throws IOException           if failed to load configuration file
     */
    public Context(String path, Configuration config)
        throws IOException, MalformedURLException
    {
        configurationManager = new ConfigurationManager(resourceToURL(path));

        setAcousticModel(config.getAcousticModelPath());
        setDictionary(config.getDictionaryPath());

        if (null != config.getGrammarPath() && config.getUseGrammar())
View Full Code Here

      String context = "trainer";

        if (argv.length == 1) {
          String configFile = argv[0];
       
          ConfigurationManager cm = new ConfigurationManager(configFile);
          Trainer trainer = (Trainer)cm.lookup (context);
          trainer.processStages(context);
        }
    }
View Full Code Here

        batchRecognizer.parseArgs(argv);
        batchRecognizer.recognize();
    }

    private void init() throws IOException {
        manager = new ConfigurationManager(config);
        recognizer = (Recognizer)manager.lookup("recognizer");
        source = (StreamDataSource)manager.lookup("streamDataSource");
       
        recognizer.allocate();       
    }
View Full Code Here

            System.exit(-1);
        }

        // dump the properties of an xml-configuration
        if (args.length == 2 && args[0].equals("-l")) {
            ConfigurationManagerUtils.dumpPropStructure(new ConfigurationManager(new File(args[1]).toURI().toURL()));
            System.exit(0);
        }

        File configFile = new File(args[0]);
        if (!configFile.isFile())
            throw new FileNotFoundException("Can not open '" + configFile + '\'');

        ConfigurationManager cm = new ConfigurationManager(configFile.toURI().toURL());

        // skip the first argument because it's the filename
        for (int i = 1; i < args.length; i++) {
            String[] splitArg = args[i].split("=");
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.util.props.ConfigurationManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.