Package edu.cmu.sphinx.util

Examples of edu.cmu.sphinx.util.TimeFrame


        Queue<List<String>> texts = new ArrayDeque<List<String>>();
        Queue<TimeFrame> timeFrames = new ArrayDeque<TimeFrame>();

        ranges.offer(new Range(0, transcript.size()));
        texts.offer(transcript);
        TimeFrame totalTimeFrame = TimeFrame.INFINITE;
        timeFrames.offer(totalTimeFrame);
        long lastFrame = TimeFrame.INFINITE.getEnd();

        for (int i = 0; i < 4; ++i) {
            if (i == 3) {
                context.setLocalProperty("decoder->searchManager",
                        "alignerSearchManager");
                context.processBatch();
            }

            while (!texts.isEmpty()) {
                assert texts.size() == ranges.size();
                assert texts.size() == timeFrames.size();

                List<String> text = texts.poll();
                TimeFrame frame = timeFrames.poll();
                Range range = ranges.poll();

                logger.info("Aligning frame " + frame + " to text " + text
                        + " range " + range);
View Full Code Here


                    + transcript.subList(start, end).toString());
            return;
        }

        texts.offer(transcript.subList(start, end));
        timeFrames.offer(new TimeFrame(timeStart, timeEnd));
        ranges.offer(new Range(start, end - 1));
    }
View Full Code Here

     * @param node the node to extract information from
     * @param confidence the confidence (posterior) to assign
     */
    public WordResult(Node node, double confidence) {
        this(node.getWord(),
             new TimeFrame(node.getBeginTime(), node.getEndTime()),
             LogMath.LOG_ZERO, confidence);
    }
View Full Code Here

        for (List<WordResult> utt : utts) {
            long startFrame = Long.MAX_VALUE;
            long endFrame = Long.MIN_VALUE;

            for (WordResult result : utt) {
                TimeFrame frame = result.getTimeFrame();
                startFrame = Math.min(startFrame, frame.getStart());
                endFrame = Math.max(endFrame, frame.getEnd());
                System.out.print(result.getPronunciation().getWord());
                System.out.print(' ');
            }

            String[] basename = inFile.getName().split("\\.wav$");
View Full Code Here

            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
View Full Code Here

        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;
View Full Code Here

                .setLanguageModelPath("resource:/edu/cmu/sphinx/models/language/en-us.lm.dmp");

        StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(
                configuration);

        TimeFrame t;
        SpeechResult result;

        for (SpeakerCluster spk : speakers) {
            Stats stats = recognizer.createStats(1);
            ArrayList<Segment> segments = spk.getSpeakerIntervals();

            for (Segment s : segments) {
                long startTime = s.getStartTime();
                long endTime = s.getStartTime() + s.getLength();
                t = new TimeFrame(startTime, endTime);

                recognizer.startRecognition(url.openStream(), t);
                while ((result = recognizer.getResult()) != null) {
                    stats.collect(result);
                }
                recognizer.stopRecognition();
            }

            Transform profile;
            // Create the Transformation
            profile = stats.createTransform();
            recognizer.setTransform(profile);

            for (Segment seg : segments) {
                long startTime = seg.getStartTime();
                long endTime = seg.getStartTime() + seg.getLength();
                t = new TimeFrame(startTime, endTime);

                // Decode again with updated SpeakerProfile
                recognizer.startRecognition(url.openStream(), t);
                while ((result = recognizer.getResult()) != null) {
                    System.out.format("Hypothesis: %s\n",
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.util.TimeFrame

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.