Package edu.cmu.sphinx.util.props

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


        if (configFile == null)
            configURL = Segmenter.class.getResource("frontend.config.xml");
        else
            configURL = new File(configFile).toURI().toURL();

        ConfigurationManager cm = new ConfigurationManager(configURL);

        if (noSplit) {
            ConfigurationManagerUtils.setProperty(cm, "wavWriter",
                    "captureUtterances", "false");
        }
View Full Code Here


            if (args.length == 2) {
                url = new File(args[1]).toURI().toURL();
            } else {
                url = AudioTool.class.getResource("spectrogram.config.xml");
            }
            ConfigurationManager cm = new ConfigurationManager(url);

            recorder = (Microphone) cm.lookup(MICROPHONE);
            recorder.initialize();
            audio = new AudioData();

            frontEnd = (FrontEnd) cm.lookup(FRONT_END);
            dataSource = (StreamDataSource) cm.lookup(DATA_SOURCE);
            cepstrumFrontEnd = (FrontEnd) cm.lookup(CESPTRUM_FRONT_END);
            cepstrumDataSource = (StreamDataSource) cm.lookup(CEPSTRUM_DATA_SOURCE);


            PropertySheet ps = cm.getPropertySheet(WINDOWER);
            float windowShiftInMs = ps.getFloat(RaisedCosineWindower.PROP_WINDOW_SHIFT_MS);

            final JFrame jframe = new JFrame("AudioTool");
            fileChooser = new JFileChooser();
            createMenuBar(jframe);
View Full Code Here

                url = new File(configFile).toURI().toURL();
            } else {
                url = FeatureFileDumper.class
                        .getResource("frontend.config.xml");
            }
            ConfigurationManager cm = new ConfigurationManager(url);
           
            if(cm.lookup(frontEndName) == null) {
              throw new RuntimeException("No such frontend: " + frontEndName);
            }
           
            FeatureFileDumper dumper = new FeatureFileDumper(cm, frontEndName);
View Full Code Here

        // probably you need to adpat this path. testconfig is located in the same folder as test
        File configFile = new File("src/test/resources/edu/cmu/sphinx/util/props/ConfigurationManagerTest.testconfig.sxl");
        if (!configFile.exists())
            Assert.fail("can not find configuration file to be used for test");

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

        DummyComp dc = (DummyComp) cm.lookup("duco");

        Assert.assertEquals(dc.getBeamWidth(), 123);
        Assert.assertEquals(9.99, dc.getAlpha(), 1E-10);

        Assert.assertTrue(dc.getFrontEnd() != null);
View Full Code Here


    @Test
    public void setComponentPropertyTest() throws IOException {
        File configFile = new File("src/test/resources/edu/cmu/sphinx/util/props/ConfigurationManagerTest.testconfig.sxl");
        ConfigurationManager cm = new ConfigurationManager(configFile.toURI().toURL());

        int newBeamWidth = 4711;
        ConfigurationManagerUtils.setProperty(cm, "beamWidth", String.valueOf(newBeamWidth));

        DummyComp dummyComp = (DummyComp) cm.lookup("duco");
        Assert.assertEquals(newBeamWidth, dummyComp.getBeamWidth());
    }
View Full Code Here

    @Test(dataProvider = "frontendProvider")
    public void testElement(String frontendName, String name)
            throws IOException {
        URL url = getClass().getResource("frontend.xml");
        ConfigurationManager cm = new ConfigurationManager(url);

        AudioFileDataSource ds = cm.lookup("audioFileDataSource");
        ds.setAudioFile(getClass().getResource("test-feat.wav"), null);

        FrontEnd frontend = cm.lookup(frontendName);
        compareDump(frontend, name);
    }
View Full Code Here

    @Test
    // note: it is not a bug but a feature of this test to print a stacktrace
    public void testDynamicConfCreationWithoutDefaultProperty() {
        try {
            ConfigurationManager cm = new ConfigurationManager();

            String instanceName = "testconf";
            cm.addConfigurable(TestConfigurable.class, instanceName);

            cm.lookup(instanceName);
            Assert.fail("add didn't fail without given default frontend");
        } catch (NullPointerException e) {
        } catch (PropertyException e) {
        }
    }
View Full Code Here

        props.put(PROP_ASTRING, testString);
        props.put(PROP_DATA_PROC, new DummyProcessor());
        TestConfigurable tc = ConfigurationManager.getInstance(TestConfigurable.class, props);

        // now create a property sheet in order to modify the configurable
        PropertySheet propSheet = new PropertySheet(tc, null, new RawPropertyData("tt", tc.getClass().getName()), new ConfigurationManager());
        propSheet.setComponent(PROP_DATA_PROC, "tt", new AnotherDummyProcessor());
        tc.newProperties(propSheet);

        // test whether old props were preserved and new ones were applied
View Full Code Here

        // TODO: make an integration test, too heavy to be a unit test
        URL audioFileURL = getClass().getResource("green.wav");
        URL configURL = getClass().getResource("config.xml");
        URL lm = getClass().getResource("hellongram.trigram.lm");

        ConfigurationManager cm = new ConfigurationManager(configURL);
        setProperty(cm, "trigramModel", "location", lm.toString());

        Recognizer recognizer = cm.lookup("recognizer");
        StreamDataSource dataSource = cm.lookup(StreamDataSource.class);

        AudioInputStream ais = getAudioInputStream(audioFileURL);
        dataSource.setInputStream(ais);

        recognizer.allocate();
        Lattice lattice = new Lattice(recognizer.recognize());

        cm = new ConfigurationManager(configURL);
        setProperty(cm, "keepAllTokens", "true");
        setProperty(cm, "trigramModel", "location", lm.toString());

        recognizer = cm.lookup("recognizer");
        recognizer.allocate();
        dataSource = cm.lookup(StreamDataSource.class);
        dataSource.setInputStream(getAudioInputStream(audioFileURL));
        Lattice allLattice = new Lattice(recognizer.recognize());

        assertTrue(lattice.isEquivalent(allLattice));
    }
View Full Code Here

public class ComponentListTests {


    @Test
    public void testInvalidList() {
        ConfigurationManager cm = new ConfigurationManager();

        Map<String, Object> props = new HashMap<String, Object>();
        cm.addConfigurable(DummyProcessor.class, "dummyA");
        props.put(DummyFrontEnd.DATA_PROCS, Arrays.asList("dummyA, dummyB"));
        cm.addConfigurable(DummyFrontEnd.class, "dfe", props);

        cm.lookup("dfe");
    }
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.