class_docstr: Transforms an input by adding summaries of person and movies provided
  by csv.
  
  Example::
      ori: Titanic is my favorite movie
      trans: The Boys Club is my favorite movie
class_docstr_tok: ["Transforms","an","input","by","adding","summaries","of","person","and","movies","provided","by","csv",".","Example",":",":","ori",":","Titanic","is","my","favorite","movie","trans",":","The","Boys","Club","is","my","favorite","movie"]
docstr: Transform text string according field.
  
  :param ~SASample sample: input data, a SASample contains
      'x' field and 'y' field
  :param string field: indicate which fields to transform,
      for multi fields, substitute them at the same time.
  :param int n: number of generated samples
  :return list trans_samples: transformed sample list.
docstr_tok: ["Transform","text","string","according","field",".",":","param","~SASample","sample",":","input","data",",","a","SASample","contains","'","x","'","field","and","'","y","'","field",":","param","string","field",":","indicate","which","fields","to","transform",",","for","multi","fields",",","substitute","them","at","the","same","time",".",":","param","int","n",":","number","of","generated","samples",":","return","list","trans_samples",":","transformed","sample","list","."]
code: def _transform(self, sample, field="x", n=5, **kwargs):
      r"""
      Transform text string according field.
  
      :param ~SASample sample: input data, a SASample contains
          'x' field and 'y' field
      :param string field: indicate which fields to transform,
          for multi fields, substitute them at the same time.
      :param int n: number of generated samples
      :return list trans_samples: transformed sample list.
      """
      # To speed up the query, dividing the original sentence into n-tuple
      # string
      tup_list = sample.concat_token(self.max_entity_len)
      replace_indices = self._get_entity_location(tup_list)
  
      if not replace_indices:
          return []
  
      trans_samples = []
  
      for i in range(n):
          # Randomly select a name for each candidate position
          sub_entity = random.sample(
              self.entity_dict.keys(), len(replace_indices)
          )
          sub_entity_token = [
              self.processor.tokenize(entity) for entity in sub_entity
          ]
          trans_samples.append(
              sample.unequal_replace_field_at_indices(
                  "x", replace_indices, sub_entity_token
              )
          )
      return trans_samples
  
file_path: textflint/textflint/generation/transformation/SA/swap_special_ent.py
imports: import random
  from ..transformation import Transformation
  from ....common.settings import SA_PERSON_PATH, SA_MOVIE_PATH
  from ....common.utils.install import download_if_needed
  from ....common.utils.load import sa_dict_loader
label_desc: Use image node_id 3 for calling the SwapSpecialEnt obj's underlying member method code with example usage: obj._transform(sample, field, n) and returns: trans_samples, list