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",")"]
code: def __init__(
      self, alphabet, operation_costs=None, allow_spaces=False
  ):
      self.alphabet = alphabet
      if operation_costs is None:
          self._make_default_operation_costs(allow_spaces=allow_spaces)
      elif not isinstance(operation_costs, dict):
          raise TypeError("Operation costs must be a dictionary")
      else:
          self.operation_costs = operation_costs
      self._make_reversed_operation_costs()
      self._make_maximal_key_lengths()
  
imports: import copy
  import itertools
  import numpy
  from sortedcontainers import SortedListWithKey
  from .tabled_trie import Trie, make_trie
label_desc: Use image node_id 1 to create a new SegmentTransducer object  with example: obj = SegmentTransducer(alphabet, operation_costs, allow_spaces)