code: def convert_file(in_file, out_file, upos):
      print("Reading %s" % in_file)
      trees = tree_reader.read_tree_file(in_file)
      print("Writing %s" % out_file)
      with open(out_file, "w") as fout:
          for tree in tqdm(trees):
              tree = tree.simplify_labels()
              text = " ".join(tree.leaf_labels())
              fout.write("# text = %s\n" % text)
  
              for pt_idx, pt in enumerate(tree.yield_preterminals()):
                  # word index
                  fout.write("%d\t" % (pt_idx + 1))
                  # word
                  fout.write("%s\t" % pt.children[0].label)
                  # don't know the lemma
                  fout.write("_\t")
                  # always put the tag, whatever it is, in the upos (for now)
                  if upos:
                      fout.write("%s\t_\t" % pt.label)
                  else:
                      fout.write("_\t%s\t" % pt.label)
                  # don't have any features
                  fout.write("_\t")
                  # so word 0 fake dep on root, everyone else fake dep on previous word
                  fout.write("%d\t" % pt_idx)
                  if pt_idx == 0:
                      fout.write("root")
                  else:
                      fout.write("dep")
                  fout.write("\t_\t_\n")
              fout.write("\n")
  
file_path: stanza/stanza/utils/datasets/pos/convert_trees_to_pos.py
imports: import argparse
  import os
  import shutil
  import sys
  from stanza.models.constituency import tree_reader
  import stanza.utils.default_paths
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: convert_file(in_file, out_file, upos) without return types