Package edu.cmu.sphinx.decoder.search

Examples of edu.cmu.sphinx.decoder.search.Token


         */
        while (true) {
            acousticScore += token.getAcousticScore()
                    + token.getInsertionScore();
            languageScore += token.getLanguageScore();
            Token preToken = token.getPredecessor();

            if (preToken == null)
                return;

            if (preToken.isWord()
                    || (loserManager != null && loserManager
                            .hasAlternatePredecessors(token)))
                break;
            token = preToken;
        }
View Full Code Here


     * @param lastToken the last token in the token chain
     * @return a list of word tokens in order of appearance
     */
    private List<Token> getWordTokens(Token lastToken) {
        List<Token> wordTokens = new LinkedList<Token>();
        Token token = lastToken;
        while (token != null) {
            if (token.isWord()) {
                wordTokens.add(0, token);
            }
            token = token.getPredecessor();
        }
        return wordTokens;
    }
View Full Code Here

     * a final state in the current frame.
     *
     * @return the best scoring final token or null
     */
    public Token getBestFinalToken() {
        Token bestToken = null;
        for (Token token : resultList) {
            if (bestToken == null || token.getScore() > bestToken.getScore()) {
                bestToken = token;
            }
        }
        return bestToken;
    }
View Full Code Here

     * can be found, then the best, non-final token is returned.
     *
     * @return the best scoring token or null
     */
    public Token getBestToken() {
        Token bestToken = getBestFinalToken();

        if (bestToken == null) {
            bestToken = getBestActiveToken();
        }

View Full Code Here

     * Returns the best scoring token in the active set
     *
     * @return the best scoring token or null
     */
    public Token getBestActiveToken() {
        Token bestToken = null;
        if (activeList != null) {
            for (Token token : activeList) {
                if (bestToken == null
                        || token.getScore() > bestToken.getScore()) {
                    bestToken = token;
                }
            }
        }
        return bestToken;
View Full Code Here

     *
     * @param text the text to match
     */
    public Token getBestActiveParitalMatchingToken(String text) {
        List<Token> matchingList = findPartialMatchingTokens(text);
        Token bestToken = null;
        for (Token token : matchingList) {
            if (bestToken == null || token.getScore() > bestToken.getScore()) {
                bestToken = token;
            }
        }
        return bestToken;
    }
View Full Code Here

     * @return the set of feature frames associated with this result, or null if the frames are not
     *         available.
     */
    public List<Data> getDataFrames() {
        // find the best token, and then trace back for all the features
        Token token = getBestToken();

        if (token == null)
            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);

        return featureList;
    }
View Full Code Here

     * the one that did not reach the final state, is returned.
     *
     * @return the string of the best result, removing any filler words
     */
    public String getBestResultNoFiller() {
        Token token = getBestToken();
        if (token == null) {
            return "";
        } else {
            return token.getWordPathNoFiller();
        }
    }
View Full Code Here

     *
     * @return the string of the best result, removing any filler words, or null if there are no
     *         best results
     */
    public String getBestFinalResultNoFiller() {
        Token token = getBestFinalToken();
        if (token == null) {
            return "";
        } else {
            return token.getWordPathNoFiller();
        }
    }
View Full Code Here

     * one[HH,W,AH,N] to[T,UW] three[TH,R,IY]
     *
     * @return the String of words and associated phonemes on the best path
     */
    public String getBestPronunciationResult() {
        Token token = getBestFinalToken();
        if (token == null) {
            return "";
        } else {
            return token.getWordPath(false, true);
        }
    }
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.decoder.search.Token

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.