class_docstr: A data structure to represent a parse tree
class_docstr_tok: ["A","data","structure","to","represent","a","parse","tree"]
docstr: Yield the preterminals one at a time in order
docstr_tok: ["Yield","the","preterminals","one","at","a","time","in","order"]
code: def yield_preterminals(self):
      """
      Yield the preterminals one at a time in order
      """
      if self.is_preterminal():
          yield self
          return
  
      if self.is_leaf():
          raise ValueError(
              "Attempted to iterate preterminals on non-internal node"
          )
  
      iterator = iter(self.children)
      node = next(iterator, None)
      while node is not None:
          if node.is_preterminal():
              yield node
          else:
              iterator = itertools.chain(node.children, iterator)
          node = next(iterator, None)
  
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 4 for calling the Tree obj's underlying member method code with example usage: obj.yield_preterminals() without return types