class_docstr: Transforms an affirmative sentence into a negative sentence, or vice versa.
  Each sample generate one transformed sample at most.
class_docstr_tok: ["Transforms","an","affirmative","sentence","into","a","negative","sentence",",","or","vice","versa",".","Each","sample","generate","one","transformed","sample","at","most","."]
docstr: Transform text string according transform_field.
  
  :param Sample sample: input data, normally one data component.
  :param str|list field: indicate which field to transform
  :param int n: number of  generated samples
  :return list trans_samples:transformed sample list.
docstr_tok: ["Transform","text","string","according","transform_field",".",":","param","Sample","sample",":","input","data",",","normally","one","data","component",".",":","param","str|list","field",":","indicate","which","field","to","transform",":","param","int","n",":","number","of","generated","samples",":","return","list","trans_samples",":","transformed","sample","list","."]
code: def _transform(
      self, sample, field="x", n=1, split_by_space=False, **kwargs
  ):
      r"""
      Transform text string according transform_field.
  
      :param Sample sample: input data, normally one data component.
      :param str|list field: indicate which field to transform
      :param int n: number of  generated samples
      :return list trans_samples:transformed sample list.
  
      """
      trans_samples = []
  
      tokens = sample.get_words(field)
      if not tokens:
          return []
  
      judge_sentence = self._judge_sentence(tokens)
  
      if judge_sentence == "remove":
          del_sample = self._get_del_sample(
              tokens, field, sample, split_by_space=split_by_space
          )
          if del_sample:
              trans_samples.append(del_sample)
  
      if judge_sentence == "add":
          add_sample = self._get_add_sample(
              field, tokens, sample, split_by_space=split_by_space
          )
          if add_sample:
              trans_samples.append(add_sample)
  
      return trans_samples
  
file_path: textflint/textflint/generation/transformation/UT/reverse_neg.py
imports: from ..transformation import Transformation
label_desc: Use image node_id 3 for calling the ReverseNeg obj's underlying member method code with example usage: obj._transform(sample, field, n, split_by_space) and returns: trans_samples, list