class_docstr: Transforms an input by replacing its number word
  
  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
docstr_tok: ["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
  
      """
      tokens = sample.get_words("sentence2")
      flag = False
  
      for num, token in enumerate(tokens):
          if token.isdigit():
              number = int(token)
              if LOWER_YEAR_NUM <= number <= UPPER_YEAR_NUM:
                  continue
              # ent_hyp = _get_entailed_hypothesis(tokens, num, number)
              cont_hyp = _get_contradictory_hypothesis(
                  tokens, num, number
              )
              flag = True
              break
  
      if not flag:
          return None
  
      sample = sample.replace_fields(
          ["sentence2", "y"], [cont_hyp, "0"]
      )
  
      return [sample]
  
file_path: textflint/textflint/generation/transformation/SMCN/swap_num.py
imports: from ..transformation import Transformation
  from ....common.utils.cn_num_word import _get_contradictory_hypothesis
label_desc: Use image node_id 4 for calling the SwapNum obj's underlying member method code with example usage: obj._transform(sample) and returns: list, None