class_docstr: Transforms an input by replacing its antonym
  
  Exmaple::
  
  {
      sentence1: 我喜欢这本书。
      sentence2: 这本书是我讨厌的。
      label: 0
  }
docstr: Transform text string, this kind of transformation can only produce one sample.
  
  :param ~SMCNSample sample: input data, a NLISample contains
      'sentence1' field, 'sentence2' field and 'y' field
  :param int n: number of generated samples,
      this transformation can only generate one sample
  :return list trans_samples: transformed sample list
      that only contain one sample
code: def _transform(self, sample, **kwargs):
      r"""
      Transform text string, this kind of transformation can only produce one sample.
  
      :param ~SMCNSample sample: input data, a NLISample contains
          'sentence1' field, 'sentence2' field and 'y' field
      :param int n: number of generated samples,
          this transformation can only generate one sample
      :return list trans_samples: transformed sample list
          that only contain one sample
  
      """
      label_tag = sample.get_value("y")
  
      if label_tag != "1":
          return None
      tokens = sample.get_words("sentence2")
      tokens = "".join(tokens)
      cnantonym = CnAntonym()
      sentence2 = cnantonym._transform(UTCnSample({"x": tokens}))
      if len(sentence2) > 0:
          sentence2 = sentence2[0].get_tokens("x")
          sentence2 = "".join(sentence2)
          newtokens = sentence2
      else:
          return None
  
      sample = sample.replace_fields(
          ["sentence2", "y"], [newtokens, "0"]
      )
  
      return [sample]
  
file_path: textflint/textflint/generation/transformation/SMCN/swap_word.py
imports: from textflint.generation.transformation.UTCN.cn_get_antonym import CnAntonym
  from textflint.input.component.sample.utcn_sample import UTCnSample
  from ..transformation import Transformation
label_desc: Use image node_id 4 for calling the SwapWord obj's underlying member method code with example usage: obj._transform(sample) and returns: list, None, None