def _analysis_probs(self, word): for prefix, suffix in segmentations(self.word_vocabulary[word]): p, s = self.prefix_vocabulary[prefix], self.suffix_vocabulary[suffix] p_split = self.prefix_model.prob(p) * self.suffix_model.prob(s) yield (p, s), p_split
def segmentations(self, w): word = self.word_vocabulary[w] for prefix, suffix in segmentations(word): p = self.prefix_vocabulary[prefix] s = self.suffix_vocabulary[suffix] yield p, s