deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def _descend_cashed(self, curr, s):
        """
        Спуск из вершины curr по строке s с кэшированием
        """
        if s == "":
            return curr
        curr_cash = self._descendance_cash[curr]
        answer = curr_cash.get(s, None)
        if answer is not None:
            return answer
        # для оптимизации дублируем код
        res = curr
        for a in s:
            res = self.graph[res][self.alphabet_codes[a]]
            # res = self.graph[res][a]
            if res == Trie.NO_NODE:
                break
        curr_cash[s] = res
        return res
def _descend_cashed(self, curr, s):
        """
        Спуск из вершины curr по строке s с кэшированием
        """
        if s == "":
            return curr
        curr_cash = self._descendance_cash[curr]
        answer = curr_cash.get(s, None)
        if answer is not None:
            return answer
        # для оптимизации дублируем код
        res = curr
        for a in s:
            res = self.graph[res][self.alphabet_codes[a]]
            # res = self.graph[res][a]
            if res == Trie.NO_NODE:
                break
        curr_cash[s] = res
        return res
def _descend_cashed ( self , curr , s ) : if s == "" : return curr curr_cash = self . _descendance_cash [ curr ] answer = curr_cash . get ( s , None ) if answer is not None : return answer # для оптимизации дублируем код res = curr for a in s : res = self . graph [ res ] [ self . alphabet_codes [ a ] ] # res = self.graph[res][a] if res == Trie . NO_NODE : break curr_cash [ s ] = res return res
Спуск из вершины curr по строке s с кэшированием
Спуск из вершины curr по строке s с кэшированием