class_docstr: A data structure to represent a parse tree
class_docstr_tok: ["A","data","structure","to","represent","a","parse","tree"]
code: def count_unary_depth(self):
      if self.is_preterminal() or self.is_leaf():
          return 0
      if len(self.children) == 1:
          t = self
          score = 0
          while (
              not t.is_preterminal()
              and not t.is_leaf()
              and len(t.children) == 1
          ):
              score = score + 1
              t = t.children[0]
          child_score = max(tc.count_unary_depth() for tc in t.children)
          score = max(score, child_score)
          return score
      score = max(t.count_unary_depth() for t in self.children)
      return score
  
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 28 for calling the Tree obj's underlying member method code with example usage: obj.count_unary_depth() and returns: score, int, score