class_docstr: Transforms input by add punctuation at the end of sentence.
docstr: Transform text string according transform_field.
  
  :param ~Sample sample: input data, normally one data component.
  :param str 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","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, **kwargs):
      r"""
      Transform text string according transform_field.
  
      :param ~Sample sample: input data, normally one data component.
      :param str 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_tokens(field)
      # remove origin punctuation at the end of sentence
      pun_indices = self._get_punctuation_scope(tokens)
      if pun_indices:
          sample = sample.delete_field_at_indices(field, pun_indices)
          tokens = sample.get_tokens(field)
      for beginning_pun, end_pun in self._generate_punctuation(n):
          trans_sample = sample.insert_field_after_index(
              field, len(tokens) - 1, end_pun
          )
          trans_sample = trans_sample.insert_field_before_index(
              field, 0, beginning_pun
          )
          trans_samples.append(trans_sample)
  
      return trans_samples
  
file_path: textflint/textflint/generation/transformation/UTCN/cn_punctuation.py
imports: from ..transformation import Transformation
label_desc: Use image node_id 3 for calling the CnPunctuation obj's underlying member method code with example usage: obj._transform(sample, field, n) and returns: trans_samples