code: def _apply_vote(self, predictions, prediction_out):
      def extract_data(prediction):
          # We need to vote by chars not labels, because the labels
          # can be different for different predictions, but labels are universal
          alternatives = []
          for pos in prediction.prediction.positions:
              d = {}
              alternatives.append(d)
              for c in pos.chars:
                  d[c.char] = c.probability
  
          return {
              "sequence": prediction.chars,
              "alternatives": alternatives,
              "positions": prediction.prediction.positions,
          }
  
      voted = perform_conf_vote([extract_data(p) for p in predictions])
  
      sentence = ""
  
      for voted_pos in voted:
          pos = PredictionPosition()
          prediction_out.positions.append(pos)
          for character in voted_pos:
              pos.chars.append(
                  PredictionCharacter(
                      char=character.char,
                      probability=character.p,
                  )
              )
  
          if len(voted_pos) > 0:
              pos.global_start = voted_pos[0].start
              pos.global_end = voted_pos[0].stop
              sentence += voted_pos[0].char
  
      prediction_out.sentence = sentence
  
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 2 for calling the ConfidenceVoter obj's underlying member method code with example usage: obj._apply_vote(predictions, prediction_out) and returns: dict