def find_partitions(self, s, max_count=<NUM_LIT:1>):
curr_agenda = [(self.root, [], <NUM_LIT:0>)]<EOL>for i, a in enumerate(s):<EOL><INDENT>next_agenda = []<EOL>for curr, borders, cost in curr_agenda:<EOL><INDENT>if cost >= max_count:<EOL><INDENT>continue<EOL><DEDENT>child = self.graph[curr][self.alphabet_codes[a]]<EOL>if child == Trie.NO_NODE:<EOL><INDENT>continue<EOL><DEDENT>next_agenda.append((child, borders, cost))<EOL>if self.is_final(child):<EOL><INDENT>next_agenda.append((self.root, borders + [i+<NUM_LIT:1>], cost+<NUM_LIT:1>))<EOL><DEDENT><DEDENT>curr_agenda = next_agenda<EOL><DEDENT>answer = []<EOL>for curr, borders, cost in curr_agenda:<EOL><INDENT>if curr == self.root:<EOL><INDENT>borders = [<NUM_LIT:0>] + borders<EOL>answer.append([s[left:borders[i+<NUM_LIT:1>]] for i, left in enumerate(borders[:-<NUM_LIT:1>])])<EOL><DEDENT><DEDENT>return answer<EOL>
Находит все разбиения s = s_1 ... s_m на словарные слова s_1, ..., s_m
для m <= max_count