class_docstr: Defines a datatype together with instructions for converting to :class:`~torch.Tensor`.
  :class:`Field` models common text processing datatypes that can be represented by tensors.
  It holds a :class:`Vocab` object that defines the set of possible values
  for elements of the field and their corresponding numerical representations.
  The :class:`Field` object also holds other parameters relating to how a datatype
  should be numericalized, such as a tokenization method.
  
  Args:
      name (str):
          The name of the field.
      pad_token (str):
          The string token used as padding. Default: ``None``.
      unk_token (str):
          The string token used to represent OOV words. Default: ``None``.
      bos_token (str):
          A token that will be prepended to every example using this field, or ``None`` for no `bos_token`.
          Default: ``None``.
      eos_token (str):
          A token that will be appended to every example using this field, or ``None`` for no `eos_token`.
      lower (bool):
          Whether to lowercase the text in this field. Default: ``False``.
      use_vocab (bool):
          Whether to use a :class:`Vocab` object. If ``False``, the data in this field should already be numerical.
          Default: ``True``.
      tokenize (function):
          The function used to tokenize strings using this field into sequential examples. Default: ``None``.
      fn (function):
          The function used for preprocessing the examples. Default: ``None``.
class_docstr_tok: ["Defines","a","datatype","together","with","instructions","for","converting","to",":","class",":","`","~torch.Tensor","`",".",":","class",":","`","Field","`","models","common","text","processing","datatypes","that","can","be","represented","by","tensors",".","It","holds","a",":","class",":","`","Vocab","`","object","that","defines","the","set","of","possible","values","for","elements","of","the","field","and","their","corresponding","numerical","representations",".","The",":","class",":","`","Field","`","object","also","holds","other","parameters","relating","to","how","a","datatype","should","be","numericalized",",","such","as","a","tokenization","method",".","Args",":","name","(","str",")",":","The","name","of","the","field",".","pad_token","(","str",")",":","The","string","token","used","as","padding",".","Default",":","``","None","``",".","unk_token","(","str",")",":","The","string","token","used","to","represent","OOV","words",".","Default",":","``","None","``",".","bos_token","(","str",")",":","A","token","that","will","be","prepended","to","every","example","using","this","field",",","or","``","None","``","for","no","`","bos_token","`",".","Default",":","``","None","``",".","eos_token","(","str",")",":","A","token","that","will","be","appended","to","every","example","using","this","field",",","or","``","None","``","for","no","`","eos_token","`",".","lower","(","bool",")",":","Whether","to","lowercase","the","text","in","this","field",".","Default",":","``","False","``",".","use_vocab","(","bool",")",":","Whether","to","use","a",":","class",":","`","Vocab","`","object",".","If","``","False","``",",","the","data","in","this","field","should","already","be","numerical",".","Default",":","``","True","``",".","tokenize","(","function",")",":","The","function","used","to","tokenize","strings","using","this","field","into","sequential","examples",".","Default",":","``","None","``",".","fn","(","function",")",":","The","function","used","for","preprocessing","the","examples",".","Default",":","``","None","``","."]
docstr: Loads a single example using this field, tokenizing if necessary.
  The sequence will be first passed to ``fn`` if available.
  If ``tokenize`` is not None, the input will be tokenized.
  Then the input will be lowercased optionally.
  
  Args:
      sequence (list):
          The sequence to be preprocessed.
  
  Returns:
      A list of preprocessed sequence.
docstr_tok: ["Loads","a","single","example","using","this","field",",","tokenizing","if","necessary",".","The","sequence","will","be","first","passed","to","``","fn","``","if","available",".","If","``","tokenize","``","is","not","None",",","the","input","will","be","tokenized",".","Then","the","input","will","be","lowercased","optionally",".","Args",":","sequence","(","list",")",":","The","sequence","to","be","preprocessed",".","Returns",":","A","list","of","preprocessed","sequence","."]
code: def preprocess(self, sequence):
      r"""
      Loads a single example using this field, tokenizing if necessary.
      The sequence will be first passed to ``fn`` if available.
      If ``tokenize`` is not None, the input will be tokenized.
      Then the input will be lowercased optionally.
  
      Args:
          sequence (list):
              The sequence to be preprocessed.
  
      Returns:
          A list of preprocessed sequence.
      """
  
      if self.fn is not None:
          sequence = self.fn(sequence)
      if self.tokenize is not None:
          sequence = self.tokenize(sequence)
      if self.lower:
          sequence = [str.lower(token) for token in sequence]
  
      return sequence
  
imports: from collections import Counter
  import torch
  from underthesea.utils.sp_fn import pad
  from underthesea.utils.sp_vocab import Vocab
label_desc: Use image node_id 8 for calling the Field obj's underlying member method code with example usage: obj.preprocess(sequence) and returns: sequence