Package edu.cmu.sphinx.frontend.databranch

Examples of edu.cmu.sphinx.frontend.databranch.DataBufferProcessor



    @Test
    public void testThreadedScorerDeallocation() throws InterruptedException {
        Map<String, Object> props = new HashMap<String, Object>();
        DataBufferProcessor dummyFrontEnd = createDummyFrontEnd();

        props.put(SimpleAcousticScorer.FEATURE_FRONTEND, dummyFrontEnd);
        props.put(ThreadedAcousticScorer.PROP_NUM_THREADS, 4);
        props.put(ConfigurationManagerUtils.GLOBAL_COMMON_LOGLEVEL, "FINEST");
        AcousticScorer scorer = ConfigurationManager.getInstance(ThreadedAcousticScorer.class, props);
View Full Code Here


        scorerClasses.add(SimpleAcousticScorer.class);
        scorerClasses.add(ThreadedAcousticScorer.class);

        for (Class<? extends SimpleAcousticScorer> scorerClass : scorerClasses) {
            System.err.println("testing: " + scorerClass.getSimpleName());
            DataBufferProcessor dummyFrontEnd = createDummyFrontEnd();

            Map<String, Object> props = new HashMap<String, Object>();
            props.put(SimpleAcousticScorer.FEATURE_FRONTEND, dummyFrontEnd);
            AcousticScorer scorer = ConfigurationManager.getInstance(scorerClass, props);

            int startBufferSize = dummyFrontEnd.getBufferSize();

            scorer.allocate();
            scorer.startRecognition();

//          Assert.assertTrue(dummyFrontEnd.getBufferSize() < (startBufferSize - 100));

            List<Scoreable> dummyTokens = Arrays.asList(testToken);

            scorer.calculateScores(dummyTokens);
            Assert.assertTrue(dummyFrontEnd.getBufferSize() < (startBufferSize - 100));

            scorer.stopRecognition();
            scorer.deallocate();
        }
    }
View Full Code Here

        }
    }


    private DataBufferProcessor createDummyFrontEnd() {
        DataBufferProcessor bufferProc = ConfigurationManager.getInstance(DataBufferProcessor.class);
        bufferProc.processDataFrame(new DataStartSignal(16000, true));

        for (DoubleData doubleData : RandomDataProcessor.createFeatVectors(5, 16000, 0, 39, 10))
            bufferProc.processDataFrame(doubleData);

        bufferProc.processDataFrame(new SpeechStartSignal());
        for (DoubleData doubleData : RandomDataProcessor.createFeatVectors(3, 16000, 1000, 39, 10))
            bufferProc.processDataFrame(doubleData);

        bufferProc.processDataFrame(new SpeechEndSignal());
        for (DoubleData doubleData : RandomDataProcessor.createFeatVectors(5, 16000, 2000, 39, 10))
            bufferProc.processDataFrame(doubleData);

        bufferProc.processDataFrame(new DataEndSignal(123));

        return bufferProc;
    }
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.frontend.databranch.DataBufferProcessor

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.