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: Factorizes the tree into a sequence.
  The tree is traversed in pre-order.
  
  Args:
      tree (nltk.tree.Tree):
          The tree to be factorized.
      delete_labels (set[str]):
          A set of labels to be ignored. This is used for evaluation.
          If it is a pre-terminal label, delete the word along with the brackets.
          If it is a non-terminal label, just delete the brackets (don't delete childrens).
          In `EVALB`_, the default set is:
          {'TOP', 'S1', '-NONE-', ',', ':', '``', "''", '.', '?', '!', ''}
          Default: ``None``.
      equal_labels (dict[str, str]):
          The key-val pairs in the dict are considered equivalent (non-directional). This is used for evaluation.
          The default dict defined in `EVALB`_ is: {'ADVP': 'PRT'}
          Default: ``None``.
  
  Returns:
      The sequence of the factorized tree.
  
  Examples:
      >>> tree = nltk.Tree.fromstring('''
                                      (TOP
                                        (S
                                          (NP (_ She))
                                          (VP (_ enjoys) (S (VP (_ playing) (NP (_ tennis)))))
                                          (_ .)))
                                      ''')
      >>> Tree.factorize(tree)
      [(0, 5, 'TOP'), (0, 5, 'S'), (0, 1, 'NP'), (1, 4, 'VP'), (2, 4, 'S'), (2, 4, 'VP'), (3, 4, 'NP')]
      >>> Tree.factorize(tree, delete_labels={'TOP', 'S1', '-NONE-', ',', ':', '``', "''", '.', '?', '!', ''})
      [(0, 5, 'S'), (0, 1, 'NP'), (1, 4, 'VP'), (2, 4, 'S'), (2, 4, 'VP'), (3, 4, 'NP')]
  
  .. _EVALB:
      https://nlp.cs.nyu.edu/evalb/
code: def factorize(cls, tree, delete_labels=None, equal_labels=None):
      r"""
      Factorizes the tree into a sequence.
      The tree is traversed in pre-order.
  
      Args:
          tree (nltk.tree.Tree):
              The tree to be factorized.
          delete_labels (set[str]):
              A set of labels to be ignored. This is used for evaluation.
              If it is a pre-terminal label, delete the word along with the brackets.
              If it is a non-terminal label, just delete the brackets (don't delete childrens).
              In `EVALB`_, the default set is:
              {'TOP', 'S1', '-NONE-', ',', ':', '``', "''", '.', '?', '!', ''}
              Default: ``None``.
          equal_labels (dict[str, str]):
              The key-val pairs in the dict are considered equivalent (non-directional). This is used for evaluation.
              The default dict defined in `EVALB`_ is: {'ADVP': 'PRT'}
              Default: ``None``.
  
      Returns:
          The sequence of the factorized tree.
  
      Examples:
          >>> tree = nltk.Tree.fromstring('''
                                          (TOP
                                            (S
                                              (NP (_ She))
                                              (VP (_ enjoys) (S (VP (_ playing) (NP (_ tennis)))))
                                              (_ .)))
                                          ''')
          >>> Tree.factorize(tree)
          [(0, 5, 'TOP'), (0, 5, 'S'), (0, 1, 'NP'), (1, 4, 'VP'), (2, 4, 'S'), (2, 4, 'VP'), (3, 4, 'NP')]
          >>> Tree.factorize(tree, delete_labels={'TOP', 'S1', '-NONE-', ',', ':', '``', "''", '.', '?', '!', ''})
          [(0, 5, 'S'), (0, 1, 'NP'), (1, 4, 'VP'), (2, 4, 'S'), (2, 4, 'VP'), (3, 4, 'NP')]
  
      .. _EVALB:
          https://nlp.cs.nyu.edu/evalb/
      """
  
      def track(tree, i):
          label = tree.label()
          if delete_labels is not None and label in delete_labels:
              label = None
          if equal_labels is not None:
              label = equal_labels.get(label, label)
          if len(tree) == 1 and not isinstance(tree[0], nltk.Tree):
              return (i + 1 if label is not None else i), []
          j, spans = i, []
          for child in tree:
              j, s = track(child, j)
              spans += s
          if label is not None and j > i:
              spans = [(i, j, label)] + spans
          return j, spans
  
      return track(tree, 0)[1]
  
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 6 for calling the Tree obj's underlying member method code with example usage: obj.factorize(cls, tree, delete_labels, equal_labels) and returns: track, j,  spans, unknown,  list