code: def replace_words(tree, words):
      """
      Remap the leaf words given a map of the labels we expect in the leaves
      """
      leaves = tree.leaf_labels()
      new_words = [words[w].word for w in leaves]
      new_tree = tree.replace_words(new_words)
      return new_tree
  
file_path: stanza/stanza/utils/datasets/constituency/convert_arboretum.py
imports: from collections import namedtuple
  import io
  import xml.etree.ElementTree
  from tqdm import tqdm
  from stanza.models.constituency.parse_tree import Tree
  from stanza.server import tsurgeon
label_desc: Use image node_id 4 for calling a global function with example usage: replace_words(tree, words) and returns: new_tree