code: def assign_associations(associations, none_value, idx_lookup):
      candidates = dict()
      for association in associations:
          for (
              bpe_idx,
              candidate_idx,
              candidate_label,
              candidate_prob,
          ) in association:
              if candidate_label == none_value:
                  continue
              if idx_lookup[bpe_idx] not in candidates:
                  candidates[idx_lookup[bpe_idx]] = []
              candidates[idx_lookup[bpe_idx]].append(
                  (
                      idx_lookup[candidate_idx],
                      candidate_label,
                      candidate_prob,
                  )
              )
  
      # TODO some how sample these candidates eg maximum probabilities, to fit some schema
      candidates = {
          k: max(v, key=lambda x: x[2]) for k, v in candidates.items()
      }  # for now just pick maximum prob
      return candidates
  
file_path: finetune/finetune/encoding/sequence_encoder.py
imports: import warnings
  import numpy
  from finetune.encoding.input_encoder import get_spacy
label_desc: Use image node_id 1 for calling a global function with example usage: assign_associations(associations, none_value, idx_lookup) and returns: candidates