class_docstr: Parallelly transforms input by common abbreviations in TwitterType.
  
  :param str mode: Twitter type, only support ['at', 'url', 'random']
class_docstr_tok: ["Parallelly","transforms","input","by","common","abbreviations","in","TwitterType",".",":","param","str","mode",":","Twitter","type",",","only","support","[","'at","'",",","'url","'",",","'random","'","]"]
docstr: Transform data sample to a list of Sample.
  
  :param ~textflint.input.component.sample.Sample sample: Data
      sample for augmentation.
  :param int n: Max number of unique augmented output, default is 5.
  :param str|list field: Indicate which fields to apply transformations.
  :param dict **kwargs: other auxiliary params.
  :return: list of Sample
docstr_tok: ["Transform","data","sample","to","a","list","of","Sample",".",":","param","~textflint.input.component.sample.Sample","sample",":","Data","sample","for","augmentation",".",":","param","int","n",":","Max","number","of","unique","augmented","output",",","default","is","5.",":","param","str|list","field",":","Indicate","which","fields","to","apply","transformations",".",":","param","dict","*","*","kwargs",":","other","auxiliary","params",".",":","return",":","list","of","Sample"]
code: def transform(
      self,
      sample,
      n=1,
      field=["source", "target"],
      split_by_space=False,
      **kwargs,
  ):
      r"""
      Transform data sample to a list of Sample.
  
      :param ~textflint.input.component.sample.Sample sample: Data
          sample for augmentation.
      :param int n: Max number of unique augmented output, default is 5.
      :param str|list field: Indicate which fields to apply transformations.
      :param dict **kwargs: other auxiliary params.
      :return: list of Sample
  
      """
      if n < 1:
          return []
  
      if not isinstance(field, list):
          assert isinstance(field, str), (
              "The type of field must be a str "
              "or list not {0}".format(type(field))
          )
          fields = [field]
      else:
          fields = field
  
      assert isinstance(fields, list), (
          "The type of field can choice in str or"
          " list,not {0}".format(type(field))
      )
      fields = list(set(fields))
  
      try:  # Deal with textflint Exception
          if len(fields) != 2:
              raise ValueError(
                  "The length of fields must be 2, not {0}.".format(
                      len(fields)
                  )
              )
          else:
              if not (
                  (fields[0] == "source" and fields[1] == "target")
                  or (fields[0] == "target" and fields[1] == "source")
              ):
                  raise ValueError(
                      "The elements of fields must be 'source' and 'target', not {0}.".format(
                          fields
                      )
                  )
              fields.sort()
              transform_results = self._transform(
                  sample,
                  n=n,
                  field=fields,
                  split_by_space=split_by_space,
                  **kwargs,
              )
      except FlintError as e:
          logger.error(str(e))
          return []
      except Exception as e:
          logger.error(str(e))
          raise FlintError(
              "You hit an internal error. "
              "Please open an issue in "
              "https://github.com/textflint/textflint"
              " to report it."
          )
      if transform_results:
          return [
              sample
              for sample in transform_results
              if (not sample.is_origin) and sample.is_legal()
          ]
      else:
          return []
  
file_path: textflint/textflint/generation/transformation/NMT/parallel_twitter_type.py
imports: import random
  import string
  import numpy
  from ....common.utils.error import FlintError
  from ....common.utils import logger
  from ..UT.twitter_type import TwitterType
label_desc: Use image node_id 9 for calling the ParallelTwitterType obj's underlying member method code with example usage: obj.transform(sample, n, field, split_by_space) and returns: list, unknown, list, list