class_docstr: Класс, реализующий взвешенный конечный преобразователь,
  осуществляющий замены из заданного списка операций
  
  Аргументы:
  ----------
  alphabet : list
      алфавит
  
  operation_costs : dict or None(optional, default=None)
      словарь вида {(up,low) : cost}
  
  allow_spaces : bool(optional, default=False)
      разрешены ли элементы трансдукции, содержащие пробел
      (используется только если явно не заданы operation costs
      и они равны значению по умолчанию)
class_docstr_tok: ["\u041a\u043b\u0430\u0441\u0441",",","\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439","\u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u0439","\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439","\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c",",","\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0449\u0438\u0439","\u0437\u0430\u043c\u0435\u043d\u044b","\u0438\u0437","\u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e","\u0441\u043f\u0438\u0441\u043a\u0430","\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439","\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b",":","--","--","--","--","--","alphabet",":","list","\u0430\u043b\u0444\u0430\u0432\u0438\u0442","operation_costs",":","dict","or","None","(","optional",",","default=None",")","\u0441\u043b\u043e\u0432\u0430\u0440\u044c","\u0432\u0438\u0434\u0430","{","(","up",",","low",")",":","cost","}","allow_spaces",":","bool","(","optional",",","default=False",")","\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b","\u043b\u0438","\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b","\u0442\u0440\u0430\u043d\u0441\u0434\u0443\u043a\u0446\u0438\u0438",",","\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435","\u043f\u0440\u043e\u0431\u0435\u043b","(","\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f","\u0442\u043e\u043b\u044c\u043a\u043e","\u0435\u0441\u043b\u0438","\u044f\u0432\u043d\u043e","\u043d\u0435","\u0437\u0430\u0434\u0430\u043d\u044b","operation","costs","\u0438","\u043e\u043d\u0438","\u0440\u0430\u0432\u043d\u044b","\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e","\u043f\u043e","\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e",")"]
docstr:     Возвращает все трансдукции с верхним элементом word,
      чья стоимость не превышает max_cost
  
  `   Возвращает:
      ----------
      result : list
          список вида [(трансдукция, стоимость)], если return_cost=True
          список трансдукций, если return_cost=False
          список отсортирован в порядке возрастания стоимости трансдукции
      
docstr_tok: ["\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442","\u0432\u0441\u0435","\u0442\u0440\u0430\u043d\u0441\u0434\u0443\u043a\u0446\u0438\u0438","\u0441","\u0432\u0435\u0440\u0445\u043d\u0438\u043c","\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c","word",",","\u0447\u044c\u044f","\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c","\u043d\u0435","\u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442","max_cost","`","\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442",":","--","--","--","--","--","result",":","list","\u0441\u043f\u0438\u0441\u043e\u043a","\u0432\u0438\u0434\u0430","[","(","\u0442\u0440\u0430\u043d\u0441\u0434\u0443\u043a\u0446\u0438\u044f",",","\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c",")","]",",","\u0435\u0441\u043b\u0438","return_cost=True","\u0441\u043f\u0438\u0441\u043e\u043a","\u0442\u0440\u0430\u043d\u0441\u0434\u0443\u043a\u0446\u0438\u0439",",","\u0435\u0441\u043b\u0438","return_cost=False","\u0441\u043f\u0438\u0441\u043e\u043a","\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d","\u0432","\u043f\u043e\u0440\u044f\u0434\u043a\u0435","\u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f","\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438","\u0442\u0440\u0430\u043d\u0441\u0434\u0443\u043a\u0446\u0438\u0438"]
code: def lower_transductions(self, word, max_cost, return_cost=True):
      """
          Возвращает все трансдукции с верхним элементом word,
          чья стоимость не превышает max_cost
  
      `   Возвращает:
          ----------
          result : list
              список вида [(трансдукция, стоимость)], если return_cost=True
              список трансдукций, если return_cost=False
              список отсортирован в порядке возрастания стоимости трансдукции
      """
      prefixes = [[] for i in range(len(word) + 1)]
      prefixes[0].append(((), 0.0))
      for pos in range(len(prefixes)):
          # вставки
          prefixes[pos] = self._perform_insertions(
              prefixes[pos], max_cost
          )
          max_upperside_length = min(
              len(word) - pos, self.max_up_length
          )
          for upperside_length in range(1, max_upperside_length + 1):
              up = word[pos : pos + upperside_length]
              for low, low_cost in self.operation_costs.get(
                  up, dict()
              ).items():
                  for transduction, cost in prefixes[pos]:
                      new_cost = cost + low_cost
                      if new_cost <= max_cost:
                          new_transduction = transduction + (up, low)
                          prefixes[pos + upperside_length].append(
                              (new_transduction, new_cost)
                          )
      answer = sorted(prefixes[-1], key=(lambda x: x[0]))
      if return_cost:
          return answer
      else:
          return [elem[0] for elem in answer]
  
imports: import copy
  import itertools
  import numpy
  from sortedcontainers import SortedListWithKey
  from .tabled_trie import Trie, make_trie
label_desc: Use image node_id 6 for calling the SegmentTransducer obj's underlying member method code with example usage: obj.lower_transductions(word, max_cost, return_cost) and returns: answer, unknown