Package edu.cmu.sphinx.linguist.dictionary

Examples of edu.cmu.sphinx.linguist.dictionary.Word


            if (logger.isLoggable(Level.FINE)) {
                logger.fine(word + " --> " + className + " " + linearProb);
            }
            wordToClassProbabilities.put(word,
                    new ClassProbability(className, logMath.linearToLog(linearProb)));
            classVocabulary.put(className, new Word(className, null, false));
            addWordInClass(className, word);
        }
        reader.close();
        checkClasses();
        logger.info("Loaded word to class mappings for " + wordToClassProbabilities.size() + " words");
View Full Code Here


                // construct the WordSequence for this N-Gram
                List<Word> wordList = new ArrayList<Word>(maxNGram);
                for (int j = 0; j < ngram; j++) {
                    String word = tok.nextToken();
                    vocabulary.add(word);
                    Word wordObject = dictionary.getWord(word);
                    if (wordObject == null) {
                        wordObject = Word.UNKNOWN;
                    }
                    wordList.add(wordObject);
                }
View Full Code Here

     */
    public float getProbability(WordSequence wordSequence) {
        Word[] classes = new Word[wordSequence.size()];
        float wordToClassProb = 0;
        for (int i = 0; i < classes.length; i++) {
            Word sourceWord = wordSequence.getWord(i);
            ClassProbability classProbability =
                classMap.getClassProbability(sourceWord.getSpelling());
            classes[i] =
                (classProbability == null ? sourceWord : classMap
                        .getClassAsWord(classProbability.getClassName()));
            if (i == classes.length - 1) {
                if (classProbability != null) {
View Full Code Here

        if (isFinal()) {
          arcs = EMPTY_ARCS;
        } else if (node.isEmpty()) {
          arcs = getNextGrammarStates(lc, nextBaseID);
        } else {
          Word word = node.getWord();
          Pronunciation[] pronunciations = word.getPronunciations();
          pronunciations = filter(pronunciations, nextBaseID);
          SearchStateArc[] nextArcs;
          if(addOutOfGrammarBranch)
             nextArcs= new SearchStateArc[pronunciations.length + 1];
          else
View Full Code Here

            } else {
                next.unitIndex = 0;
                Word[] alternative =
                        next.node.getAlternatives()[alternativeIndex];
                if (++next.wordIndex < alternative.length) {
                    Word word = alternative[next.wordIndex];
                    for (int i = 0; i < word.getPronunciations(null).length;
                         i++) {
                        GrammarPoint newGP = new GrammarPoint(next.node,
                                next.alternativeIndex, next.wordIndex, i, 0);
                        nextPoints.add(newGP);
                    }
View Full Code Here

        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) {
                        sb.insert(0, ']');
                        Unit[] u = pron.getUnits();
                        for (int i = u.length - 1; i >= 0; i--) {
                            if (i < u.length - 1) sb.insert(0, ',');
                            sb.insert(0, u[i].getName());
                        }
                        sb.insert(0, '[');
                    }
                    sb.insert(0, word.getSpelling());
                    sb.insert(0, ' ');
                }
            }
            token = token.getPredecessor();
        }
View Full Code Here

        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

        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.dictionary.Word

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.