class_docstr: Sample negative spot and asoc to construct SSI
class_docstr_tok: ["Sample","negative","spot","and","asoc","to","construct","SSI"]
code: def convert_prefix(candidates, prompt, mapper, ordered_prompt=True):
      prefix = list()
  
      if ordered_prompt:
          candidate_sorted = sorted(
              [
                  (candidate, index)
                  for index, candidate in enumerate(candidates)
              ]
          )
          index_list = [index for _, index in candidate_sorted]
      else:
          index_list = torch.randperm(len(candidates)).tolist()
  
      for index in index_list:
          prefix += [prompt]
          prefix += mapper[candidates[index]]
      return prefix
  
imports: import os
  from dataclasses import dataclass
  import torch
  import logging
  import random
  import math
  from typing import Optional, Union
  from collections import OrderedDict
  from transformers import PreTrainedTokenizerBase, PreTrainedModel
  from transformers.file_utils import PaddingStrategy
  from ...extraction.record_schema import RecordSchema
  from ...extraction.dataset_processer import spot_prompt, asoc_prompt
  from ...extraction.constants import BaseStructureMarker, text_start
  from ...extraction.utils import convert_to_record_function
  from ...extraction.noiser.spot_asoc_noiser import SpotAsocNoiser
label_desc: Use image node_id 8 for calling the DynamicSSIGenerator obj's underlying member method code with example usage: obj.convert_prefix(candidates, prompt, mapper, ordered_prompt) and returns: prefix