Package edu.cmu.sphinx.linguist

Examples of edu.cmu.sphinx.linguist.WordSearchState


        if (token.getWord().isSentenceEndWord()) {
            return terminalNode;
        }
        Node node = nodes.get(getNodeID(token));
        if (node == null) {
            WordSearchState wordState =
                    (WordSearchState) token.getSearchState();

            int startFrame = -1;
            int endFrame = -1;

            if (wordState.isWordStart()) {
                startFrame = token.getFrameNumber();
            } else {
                endFrame = token.getFrameNumber();
            }
View Full Code Here


            Map<Word, Integer> countMap = new HashMap<Word, Integer>();
            Collections.sort(tokenList, Scoreable.COMPARATOR);
            // remove word duplicates
            for (Iterator<Token> i = tokenList.iterator(); i.hasNext();) {
                Token token = i.next();
                WordSearchState wordState = (WordSearchState)token.getSearchState();

                Word word = wordState.getPronunciation().getWord();

                // only allow  maxFiller words
                if (maxFiller > 0) {
                    if (word.isFiller()) {
                        if (fillerCount < maxFiller) {
View Full Code Here

        int startFrame = dumpBestPath(out, utt, pred);
        if (token.isWord()) {

            int endFrame = token.getFrameNumber();

            WordSearchState wordState = (WordSearchState) token.getSearchState();
            Word word = wordState.getPronunciation().getWord();
            String spelling = word.getSpelling();
            if (!spelling.startsWith("<")) {
                String[] names = utt.name.split("_");
                out.write((names[0] + '_' + names[1] + '_' + names[2]
                        + " 1 " + (utt.startOffset + startFrame) / 100.0 + ' ' + (endFrame - startFrame) / 100.0 + ' ').getBytes());
View Full Code Here

        StringBuilder sb = new StringBuilder();
        Token token = this;

        while (token != null) {
            if (token.isWord()) {
                WordSearchState wordState =
                        (WordSearchState) token.getSearchState();
                Pronunciation pron = wordState.getPronunciation();
                Word word = wordState.getPronunciation().getWord();

//                System.out.println(token.getFrameNumber() + " " + word + " " + token.logLanguageScore + " " + token.logAcousticScore);

                if (wantFiller || !word.isFiller()) {
                    if (wantPronunciations) {
View Full Code Here

        Token token = this;

        while (token != null) {
            SearchState searchState = token.getSearchState();
            if (searchState instanceof WordSearchState) {
                WordSearchState wordState = (WordSearchState) searchState;
                Word word = wordState.getPronunciation().getWord();
                sb.insert(0, ' ' + word.getSpelling());
            } else if (searchState instanceof UnitSearchState) {
                UnitSearchState unitState = (UnitSearchState) searchState;
                Unit unit = unitState.getUnit();
                sb.insert(0, ' ' + unit.getName());
View Full Code Here

     *
     * @return the word of this Token, or null if this is not a word token
     */
    public Word getWord() {
        if (isWord()) {
            WordSearchState wordState = (WordSearchState) searchState;
            return wordState.getPronunciation().getWord();
        } else {
            return null;
        }
    }
View Full Code Here

    private WordSequence getWordSequence(Token token) {
        List<Word> wordList = new LinkedList<Word>();

        while (token != null) {
            if (token.isWord()) {
                WordSearchState wordState = (WordSearchState) token
                        .getSearchState();
                Word word = wordState.getPronunciation().getWord();
                wordList.add(0, word);
            }
            token = token.getPredecessor();
        }
        return new WordSequence(wordList);
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.linguist.WordSearchState

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.