Examples of ProbDepth


Examples of edu.cmu.sphinx.linguist.language.ngram.ProbDepth

                        wordSequence,
                        smearTerm, logOne, languageProbability, collapsed);
            }

            WordSequence nextWordSequence = wordSequence.addWord(nextWord, maxDepth);
            ProbDepth probDepth = languageModel.getProbDepth(nextWordSequence);
            smearTerm = getSmearTermFromLanguageModel(nextWordSequence);
            // System.out.println("LP " + nextWordSequence + " " +
            // logProbability);
            float probability = probDepth.probability * languageWeight;
            // subtract off the previously applied smear probability
View Full Code Here

Examples of edu.cmu.sphinx.linguist.language.ngram.ProbDepth

     *
     * @param wordSequence sequence to get the probability
     */
    public ProbDepth getProbDepth(WordSequence wordSequence) {
        int numberWords = wordSequence.size();
        ProbDepth probDepth = null;

        if (numberWords > maxDepth) {
            throw new Error("Unsupported NGram: " + wordSequence.size());
        }

View Full Code Here

Examples of edu.cmu.sphinx.linguist.language.ngram.ProbDepth

        if (nGProbability != null) {
            float probability =
                ngramProbTable[numberWords - 1][nGProbability
                        .getProbabilityID()];
            return new ProbDepth(probability, numberWords);
        }

        if (numberWords == 2) {
            UnigramProbability unigramProb = getUnigram(firstWord);
            UnigramProbability unigramProb1 =
                getUnigram(wordSequence.getWord(1));
            float probability =
                unigramProb.getLogBackoff() + unigramProb1.getLogProbability();
            return new ProbDepth(probability, 1);
        }

        NGramProbability nMinus1Gram = findNGram(wordSequence.getOldest());

        if (nMinus1Gram != null) {
            ProbDepth result1 = getProbDepth(wordSequence.getNewest());
            float probability =
                ngramBackoffTable[numberWords - 1][nMinus1Gram.getBackoffID()] +
                        result1.probability;
            return new ProbDepth(probability, result1.depth);
        }

        return getProbDepth(wordSequence.getNewest());
    }
View Full Code Here

Examples of edu.cmu.sphinx.linguist.language.ngram.ProbDepth

     * @param wordSequence the word sequence
     * @return the probability of the word sequence. Probability is in logMath
     *         log base
     */
    public float getProbability(WordSequence wordSequence) {
        ProbDepth probDepth = getProbDepth(wordSequence);
        return probDepth.probability;
    }
View Full Code Here

Examples of edu.cmu.sphinx.linguist.language.ngram.ProbDepth

        UnigramProbability unigramProb = getUnigram(unigram);

        if (unigramProb == null)
            throw new Error("Unigram not in LM: " + unigram);

        return new ProbDepth(unigramProb.getLogProbability(), 1);
    }
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.