code: def perform_conf_vote(voters):
      results = [voter["sequence"] for voter in voters]
      synclist = synchronize(results)
  
      final_result = []
  
      for sync in synclist:
          (
              actual_voters,
              most_freq_length,
          ) = find_voters_with_most_frequent_length(sync, voters)
  
          # set of all characters (check if all say the same, then the set size is one)
          s = []
          for r in [
              voters[voter_id]["sequence"][
                  sync.start(voter_id) : sync.stop(voter_id) + 1
              ]
              for voter_id in actual_voters
          ]:
              if r not in s:
                  s.append(r)
  
          def add_char(actual_voters, i):
              c_p = {}
              for voter_id in actual_voters:
                  idx = i + sync.start(voter_id)
                  alts = voters[voter_id]["alternatives"][idx]
                  pos = voters[voter_id]["positions"][idx]
                  for k, p in alts.items():
                      if k in c_p:
                          c_p[k].merge(
                              k,
                              p / len(actual_voters),
                              pos.global_start,
                              pos.global_end,
                          )
                      else:
                          c_p[k] = MergeableCharacter(
                              k,
                              p / len(actual_voters),
                              pos.global_start,
                              pos.global_end,
                          )
  
              chars = sorted(c_p.values(), key=lambda v: -v.p)
              final_result.append(chars)
  
          if len(s) == 1:
              sentence = s.pop()
              for i in range(len(sentence)):
                  add_char(actual_voters, i)
  
              continue
  
          if len(actual_voters) == 1:
              voter_id = actual_voters[0]
              for i in range(sync.length(voter_id)):
                  add_char([voter_id], i)
          else:
              for i in range(most_freq_length):
                  add_char(actual_voters, i)
  
      return final_result
  
file_path: calamari/calamari_ocr/ocr/voting/confidence_voter.py
imports: import operator
  from calamari_ocr.ocr.model.ctcdecoder.ctc_decoder import PredictionPosition, PredictionCharacter
  from calamari_ocr.ocr.dataset.textprocessors import synchronize
  from calamari_ocr.ocr.voting.voter import Voter
label_desc: Use image node_id 3 for calling a global function with example usage: perform_conf_vote(voters) and returns: final_result