class_docstr: The Tree object factorize a constituency tree into four fields, each associated with one or more :class:`Field` objects.
  
  Attributes:
      WORD:
          Words in the sentence.
      POS:
          Part-of-speech tags, or underscores if not available.
      TREE:
          The raw constituency tree in :class:`nltk.tree.Tree` format.
      CHART:
          The factorized sequence of binarized tree traversed in pre-order.
class_docstr_tok: ["The","Tree","object","factorize","a","constituency","tree","into","four","fields",",","each","associated","with","one","or","more",":","class",":","`","Field","`","objects",".","Attributes",":","WORD",":","Words","in","the","sentence",".","POS",":","Part-of-speech","tags",",","or","underscores","if","not","available",".","TREE",":","The","raw","constituency","tree","in",":","class",":","`","nltk.tree.Tree","`","format",".","CHART",":","The","factorized","sequence","of","binarized","tree","traversed","in","pre-order","."]
docstr: Converts a list of tokens to a :class:`nltk.tree.Tree`.
  Missing fields are filled with underscores.
  
  Args:
      tokens (list[str] or list[tuple]):
          This can be either a list of words or word/pos pairs.
      root (str):
          The root label of the tree. Default: ''.
  
  Returns:
      A :class:`nltk.tree.Tree` object.
  
  Examples:
      >>> print(Tree.totree(['She', 'enjoys', 'playing', 'tennis', '.'], 'TOP'))
      (TOP (_ She) (_ enjoys) (_ playing) (_ tennis) (_ .))
code: def totree(cls, tokens, root=""):
      r"""
      Converts a list of tokens to a :class:`nltk.tree.Tree`.
      Missing fields are filled with underscores.
  
      Args:
          tokens (list[str] or list[tuple]):
              This can be either a list of words or word/pos pairs.
          root (str):
              The root label of the tree. Default: ''.
  
      Returns:
          A :class:`nltk.tree.Tree` object.
  
      Examples:
          >>> print(Tree.totree(['She', 'enjoys', 'playing', 'tennis', '.'], 'TOP'))
          (TOP (_ She) (_ enjoys) (_ playing) (_ tennis) (_ .))
      """
  
      if isinstance(tokens[0], str):
          tokens = [(token, "_") for token in tokens]
      tree = " ".join([f"({pos} {word})" for word, pos in tokens])
      return nltk.Tree.fromstring(f"({root} {tree})")
  
imports: from collections.abc import Iterable
  import nltk
  from tqdm import tqdm
  from underthesea.utils.sp_parallel import is_master
label_desc: Use image node_id 4 for calling the Tree obj's underlying member method code with example usage: obj.totree(cls, tokens, root) and returns: nltk