return new LexTreeWordState(wordNode, lastUnit,
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
languageProbability = probability - previous.getSmearProb();
boolean collapse = (probDepth.depth < maxDepth - 1) || !fullWordHistories;
if (nextWord == sentenceEndWord) {
return new LexTreeEndWordState(wordNode, lastUnit,
nextWordSequence.trim(maxDepth - 1),
smearTerm, logOne, languageProbability, collapse);
}
return new LexTreeWordState(wordNode, lastUnit,
nextWordSequence.trim(maxDepth - 1),
smearTerm, logOne, languageProbability, collapse);
}