def generic_find(self, word): lemma_manager = Lemma(word) initial = lemma_manager.initial() prefix = lemma_manager.prefix() dsort = lemma_manager.lexical_sort() if not prefix in NgramFinder.cache: self.update_cache(initial, prefix) NgramFinder.call_num += 1 NgramFinder.cache[prefix]["call_num"] = NgramFinder.call_num return NgramFinder.cache[prefix]["grams"].get(dsort, [])
def _compose_sort_values(self): lemma_manager = Lemma(self.morphunits[0].form) self._lexical_sort = lemma_manager.lexical_sort() self._initial = lemma_manager.initial() self._prefix = lemma_manager.prefix()