class_docstr: A data structure to represent a parse tree
class_docstr_tok: ["A","data","structure","to","represent","a","parse","tree"]
code: def get_compound_constituents(trees, separate_root=False):
      constituents = set()
      stack = deque()
      for tree in trees:
          if separate_root:
              constituents.add((tree.label,))
              for child in tree.children:
                  stack.append(child)
          else:
              stack.append(tree)
          while len(stack) > 0:
              node = stack.pop()
              if node.is_leaf() or node.is_preterminal():
                  continue
              labels = [node.label]
              while (
                  len(node.children) == 1
                  and not node.children[0].is_preterminal()
              ):
                  node = node.children[0]
                  labels.append(node.label)
              constituents.add(tuple(labels))
              for child in node.children:
                  stack.append(child)
      return sorted(constituents)
  
imports: from collections import deque, Counter
  from enum import Enum
  from io import StringIO
  import itertools
  import re
  import warnings
  from stanza.models.common.stanza_object import StanzaObject
label_desc: Use image node_id 21 for calling the Tree obj's underlying member method code with example usage: obj.get_compound_constituents(trees, separate_root) and returns: sorted