Examples of ExtendedStreamTokenizer


Examples of edu.cmu.sphinx.util.ExtendedStreamTokenizer

     * @param path the path of the FST file to read
     * @return the highest ID of all nodes
     * @throws java.io.IOException
     */
    private int createNodes(String path) throws IOException {
        ExtendedStreamTokenizer tok = new ExtendedStreamTokenizer(path, true);
        int maxNodeId = 0;
        while (!tok.isEOF()) {
            tok.skipwhite();
            String token = tok.getString();
            if (token == null) {
                break;
            } else if (token.equals("T")) {
                tok.getInt("src id"); // toss source node
                int id = tok.getInt("dest id"); // dest node numb
                if (id > maxNodeId) {
                    maxNodeId = id;
                }
                String word1 = tok.getString(); // get word
                if (word1 == null) {
                    continue;
                }
                String word2 = tok.getString(); // get word
                tok.getString(); // toss probability
                String nodeName = "G" + id;
                GrammarNode node = nodes.get(nodeName);
                if (node == null) {
                    if (word2.equals(",")) {
                        node = createGrammarNode(id, false);
                    } else {
                        node = createGrammarNode(id, word2.toLowerCase());
                    }
                    nodes.put(nodeName, node);
                } else {
                    if (!word2.equals(",")) {
                        /*
                         * if (!word2.toLowerCase().equals(getWord(node))) {
                         * System.out.println(node + ": " + word2 + ' ' + getWord(node)); }
                         */
                        assert (word2.toLowerCase().equals(getWord(node)));
                    }
                }
            }
        }
        tok.close();
        return maxNodeId;
    }
View Full Code Here

Examples of edu.cmu.sphinx.util.ExtendedStreamTokenizer

                numPoints = Utilities.readLittleEndianInt(binaryStream);
                System.out.println("LittleEndian");
            }
            System.out.println("Frames: " + numPoints / cepstrumLength);
        } else {
            est = new ExtendedStreamTokenizer(is, false);
            numPoints = est.getInt("num_frames");
            est.expectString("frames");
        }
        curPoint = -1;
        firstSampleNumber = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.