class_docstr: The hierarchical tree representing the entirety of a parse.
docstr: Factory method to create trees from sentences parses, i.e. lists of words.
  
  >>> from cltk.languages.example_texts import get_example_text
  >>> from cltk.dependency.processes import StanzaProcess
  >>> process_stanza = StanzaProcess(language="lat")
  >>> output_doc = process_stanza.run(Doc(raw=get_example_text("lat")))
  >>> a_sentence = output_doc.sentences[0]
  >>> t = DependencyTree.to_tree(a_sentence)
  >>> t.findall(".")
  [divisa_3/adjective]
docstr_tok: ["Factory","method","to","create","trees","from","sentences","parses",",","i.e",".","lists","of","words",".",">",">",">","from","cltk.languages.example_texts","import","get_example_text",">",">",">","from","cltk.dependency.processes","import","StanzaProcess",">",">",">","process_stanza","=","StanzaProcess","(","language=","''","lat","''",")",">",">",">","output_doc","=","process_stanza.run","(","Doc","(","raw=get_example_text","(","``","lat","''",")",")",")",">",">",">","a_sentence","=","output_doc.sentences","[","0","]",">",">",">","t","=","DependencyTree.to_tree","(","a_sentence",")",">",">",">","t.findall","(","``",".","''",")","[","divisa_3\/adjective","]"]
code: def to_tree(sentence: List[Word]) -> "DependencyTree":
      """Factory method to create trees from sentences parses, i.e. lists of words.
  
      >>> from cltk.languages.example_texts import get_example_text
      >>> from cltk.dependency.processes import StanzaProcess
      >>> process_stanza = StanzaProcess(language="lat")
      >>> output_doc = process_stanza.run(Doc(raw=get_example_text("lat")))
      >>> a_sentence = output_doc.sentences[0]
      >>> t = DependencyTree.to_tree(a_sentence)
      >>> t.findall(".")
      [divisa_3/adjective]
      """
  
      forms: dict[int, Form] = {}
      for word in sentence:
          forms[word.index_token] = Form.to_form(word)
      root = None
      for word in sentence:
          # Note: LatinCy uses uppercase `ROOT`, Stanza lowercase `root`
          if word.dependency_relation in ["root", "ROOT"]:
              root = forms[word.index_token]
          elif word.governor != -1:
              # only add a non-root element to the tree if it has a governor (i.e. not -1)
              gov = forms[word.governor]
              dep = forms[word.index_token]
              gov >> dep | word.dependency_relation
  
      return DependencyTree(root) if root else None
  
imports: from typing import Dict, List, Union
  from xml.etree.ElementTree import Element, ElementTree
  from cltk.core.data_types import Doc, Process, Word
  from cltk.core.exceptions import CLTKException
  from cltk.morphology.universal_dependencies_features import NOMINAL_FEATURES, OTHER_FEATURES, VERBAL_FEATURES, MorphosyntacticFeature
label_desc: Use image node_id 4 for calling the DependencyTree obj's underlying member method code with example usage: obj.to_tree(sentence) and returns: unknown