class_docstr: Swap entities which shorter than threshold to longer ones.
docstr: Transform data sample to a list of Sample.
  
  :param ~NERSample sample: Data sample for augmentation
  :param int n: Default is 1. MAx number of unique augmented output
  :param **kwargs:
  :return: Augmented data
docstr_tok: ["Transform","data","sample","to","a","list","of","Sample",".",":","param","~NERSample","sample",":","Data","sample","for","augmentation",":","param","int","n",":","Default","is","1",".","MAx","number","of","unique","augmented","output",":","param","*","*","kwargs",":",":","return",":","Augmented","data"]
code: def _transform(self, sample, n=1, **kwargs):
      r"""
      Transform data sample to a list of Sample.
  
      :param ~NERSample sample: Data sample for augmentation
      :param int n: Default is 1. MAx number of unique augmented output
      :param **kwargs:
      :return: Augmented data
      """
      rep_samples = []
      rep_entities = []
      entities = sample.entities[::-1]
      candidates = []
  
      for entity in entities:
          if entity["entity"] in self.res_dic[entity["tag"]]:
              res_dic = self.res_dic
              res_dic[entity["tag"]].remove(entity["entity"])
          else:
              res_dic = self.res_dic
          if (
              entity["tag"] == "PER"
              or entity["tag"] == "ORG"
              or entity["tag"] == "LOC"
          ):
              rep_entities.append(entity)
              candidates.append(
                  random.sample(res_dic[entity["tag"]], n)
              )
  
      for i in range(n):
          _candidates = [candidate[i] for candidate in candidates]
          if not _candidates:
              return []
          rep_samples.append(
              sample.entities_replace(rep_entities, _candidates)
          )
  
      return rep_samples
  
file_path: textflint/textflint/generation/transformation/NER/swap_ent.py
imports: import random
  from ....common.settings import LONG_ENTITIES
  from ....common.settings import CROSS_ENTITIES
  from ....common.utils.load import read_cross_entities
  from ....common.settings import NER_OOV_ENTITIES
  from ....common.utils.load import load_oov_entities
  from ....common.utils.install import download_if_needed
  from ....common.utils.load import json_loader
  from ..transformation import Transformation
label_desc: Use image node_id 3 for calling the SwapEnt obj's underlying member method code with example usage: obj._transform(sample, n) and returns: rep_samples, list