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: Builds a constituency tree from the sequence. The sequence is generated in pre-order.
  During building the tree, the sequence is de-binarized to the original format (i.e.,
  the suffixes ``|<>`` are ignored, the collapsed labels are recovered).
  
  Args:
      tree (nltk.tree.Tree):
          An empty tree that provides a base for building a result tree.
      sequence (list[tuple]):
          A list of tuples used for generating a tree.
          Each tuple consits of the indices of left/right span boundaries and label of the span.
  
  Returns:
      A result constituency tree.
  
  Examples:
      >>> tree = Tree.totree(['She', 'enjoys', 'playing', 'tennis', '.'], 'TOP')
      >>> sequence = [(0, 5, 'S'), (0, 4, 'S|<>'), (0, 1, 'NP'), (1, 4, 'VP'), (1, 2, 'VP|<>'),
                      (2, 4, 'S+VP'), (2, 3, 'VP|<>'), (3, 4, 'NP'), (4, 5, 'S|<>')]
      >>> print(Tree.build(tree, sequence))
      (TOP
        (S
          (NP (_ She))
          (VP (_ enjoys) (S (VP (_ playing) (NP (_ tennis)))))
          (_ .)))
code: def build(cls, tree, sequence):
      r"""
      Builds a constituency tree from the sequence. The sequence is generated in pre-order.
      During building the tree, the sequence is de-binarized to the original format (i.e.,
      the suffixes ``|<>`` are ignored, the collapsed labels are recovered).
  
      Args:
          tree (nltk.tree.Tree):
              An empty tree that provides a base for building a result tree.
          sequence (list[tuple]):
              A list of tuples used for generating a tree.
              Each tuple consits of the indices of left/right span boundaries and label of the span.
  
      Returns:
          A result constituency tree.
  
      Examples:
          >>> tree = Tree.totree(['She', 'enjoys', 'playing', 'tennis', '.'], 'TOP')
          >>> sequence = [(0, 5, 'S'), (0, 4, 'S|<>'), (0, 1, 'NP'), (1, 4, 'VP'), (1, 2, 'VP|<>'),
                          (2, 4, 'S+VP'), (2, 3, 'VP|<>'), (3, 4, 'NP'), (4, 5, 'S|<>')]
          >>> print(Tree.build(tree, sequence))
          (TOP
            (S
              (NP (_ She))
              (VP (_ enjoys) (S (VP (_ playing) (NP (_ tennis)))))
              (_ .)))
      """
  
      root = tree.label()
      leaves = [
          subtree
          for subtree in tree.subtrees()
          if not isinstance(subtree[0], nltk.Tree)
      ]
  
      def track(node):
          i, j, label = next(node)
          if j == i + 1:
              children = [leaves[i]]
          else:
              children = track(node) + track(node)
          if label.endswith("|<>"):
              return children
          labels = label.split("+")
          tree = nltk.Tree(labels[-1], children)
          for label in reversed(labels[:-1]):
              tree = nltk.Tree(label, [tree])
          return [tree]
  
      return nltk.Tree(root, track(iter(sequence)))
  
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 7 for calling the Tree obj's underlying member method code with example usage: obj.build(cls, tree, sequence) and returns: nltk, list, children