Package edu.cmu.sphinx.frontend

Examples of edu.cmu.sphinx.frontend.Data


     */
    protected boolean scoreTokens() {
        boolean hasMoreFrames = false;

        scoreTimer.start();
        Data data = scorer.calculateScores(activeList.getTokens());
        scoreTimer.stop();
       
        Token bestToken = null;
        if (data instanceof Token) {
            bestToken = (Token)data;
View Full Code Here


            return null;

        List<Data> featureList = new LinkedList<Data>();

        do {
            Data feature = token.getData();
            if (feature != null)
                featureList.add(0, feature);

            token = token.getPredecessor();
        } while (token != null);
View Full Code Here

            token = token.getPredecessor();
        }

        List<WordResult> result = new ArrayList<WordResult>();
        if (token != null) {
            Data prevWordFirstFeature = token.getData();
            Data prevFeature = prevWordFirstFeature;
            token = token.getPredecessor();

            while (token != null) {
                if (token.isWord()) {
                    Word word = token.getWord();
                    if (withFillers || !word.isFiller()) {
                        TimeFrame timeFrame =
                                new TimeFrame(
                                        ((FloatData) prevFeature)
                                                .getCollectTime(),
                                        ((FloatData) prevWordFirstFeature)
                                                .getCollectTime());
                        result.add(new WordResult(word, timeFrame, token
                                .getScore(), 1.));
                    }
                    prevWordFirstFeature = prevFeature;
                }
                Data feature = token.getData();
                if (feature != null) {
                    prevFeature = feature;
                }
                token = token.getPredecessor();
            }
View Full Code Here

     *
     * @return the string of words, each with the starting sample number
     */
    private List<WordResult> getTimedWordTokenLastPath(Token token, boolean withFillers) {
        Word word = null;
        Data lastFeature = null;
        Data lastWordFirstFeature = null;
        List<WordResult> result = new ArrayList<WordResult>();

        while (token != null) {
            if (token.isWord()) {
                if (word != null && lastFeature != null) {
                    if (withFillers || !word.isFiller()) {
                        TimeFrame timeFrame = new TimeFrame(((FloatData) lastFeature).getCollectTime(),
                                ((FloatData) lastWordFirstFeature).getCollectTime());
                        result.add(new WordResult(word, timeFrame, token.getScore(), 1.));
                    }
                    word = token.getWord();
                    lastWordFirstFeature = lastFeature;
                }
                word = token.getWord();
            }
            Data feature = token.getData();
            if (feature != null) {
                lastFeature = feature;
                if (lastWordFirstFeature == null) {
                    lastWordFirstFeature = lastFeature;
                }
View Full Code Here

        /* [[[WDW - TODO: this is not the most efficient way
         * to do this, but it at least works for now.]]]
         */
        while (recorder.hasMoreData()) {
            try {
                Data data = recorder.getData();
                if (data instanceof DoubleData) {
                    sampleRate =
                            ((DoubleData) data).getSampleRate();
                    double[] values =
                            ((DoubleData) data).getValues();
View Full Code Here

     * @return <code>true</code> if there are more frames to score, otherwise, false
     */
    protected boolean scoreTokens() {
        boolean moreTokens;
        scoreTimer.start();
        Data data = scorer.calculateScores(activeList.getTokens());
        scoreTimer.stop();

        Token bestToken = null;
        if (data instanceof Token) {
            bestToken = (Token)data;
View Full Code Here

     * @throws edu.cmu.sphinx.frontend.DataProcessingException
     *          if a data processing error occurred
     */
    @Override
    public Data getData() throws DataProcessingException {
        Data input = getPredecessor().getData(); // get the spectrum

        if (input instanceof DataStartSignal)
            prepareForNewStream();

        getTimer().start();
View Full Code Here

    public List<Data> collectOutput(BaseDataProcessor dataProc) throws DataProcessingException {
        dataProc.setPredecessor(this);

        List<Data> output = new ArrayList<Data>();

        Data d;
        while ((d = dataProc.getData()) != null) {
            output.add(d);
        }

        return output;
View Full Code Here

             * them to an log intensity value.
             */
            ArrayList<float[]> intensitiesList = new ArrayList<float[]>();
            float maxIntensity[] = new float[100];
            Arrays.fill(maxIntensity, Float.MIN_VALUE);
            Data spectrum = frontEnd.getData();

            while (!(spectrum instanceof DataEndSignal)) {
                if (spectrum instanceof FloatData) {
                    float[] spectrumData = ((FloatData) spectrum).getValues();
                    float[] intensities = new float[spectrumData.length];
View Full Code Here

            /* Run through all the spectra one at a time and convert
             * them to an log intensity value.
             */
            ArrayList<double[]> intensitiesList = new ArrayList<double[]>();
            double maxIntensity = Double.MIN_VALUE;
            Data spectrum = frontEnd.getData();

            while (!(spectrum instanceof DataEndSignal)) {
                if (spectrum instanceof DoubleData) {
                    double[] spectrumData = ((DoubleData) spectrum).getValues();
                    double[] intensities = new double[spectrumData.length];
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.frontend.Data

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.