code: def run_treebank(
      mode,
      paths,
      treebank,
      short_name,
      temp_output_file,
      command_args,
      extra_args,
  ):
      constituency_dir = paths["CONSTITUENCY_DATA_DIR"]
      short_language, dataset = short_name.split("_")
  
      train_file = os.path.join(
          constituency_dir, f"{short_name}_train.mrg"
      )
      dev_file = os.path.join(constituency_dir, f"{short_name}_dev.mrg")
      test_file = os.path.join(
          constituency_dir, f"{short_name}_test.mrg"
      )
  
      if (
          not os.path.exists(train_file)
          or not os.path.exists(dev_file)
          or not os.path.exists(test_file)
      ):
          logger.warning(
              f"The data for {short_name} is missing or incomplete.  Attempting to rebuild..."
          )
          try:
              prepare_con_dataset.main(short_name)
          except:
              logger.error(
                  f"Unable to build the data.  Please correctly build the files in {train_file}, {dev_file}, {test_file} and then try again."
              )
              raise
  
      default_args = build_default_args(
          paths, short_language, dataset, command_args, extra_args
      )
  
      if mode == Mode.TRAIN:
          train_args = [
              "--train_file",
              train_file,
              "--eval_file",
              dev_file,
              "--shorthand",
              short_name,
              "--mode",
              "train",
          ]
          train_args = train_args + default_args + extra_args
          logger.info(
              "Running train step with args: {}".format(train_args)
          )
          constituency_parser.main(train_args)
  
      if mode == Mode.SCORE_DEV or mode == Mode.TRAIN:
          dev_args = [
              "--eval_file",
              dev_file,
              "--shorthand",
              short_name,
              "--mode",
              "predict",
          ]
          dev_args = dev_args + default_args + extra_args
          logger.info("Running dev step with args: {}".format(dev_args))
          constituency_parser.main(dev_args)
  
      if mode == Mode.SCORE_TEST or mode == Mode.TRAIN:
          test_args = [
              "--eval_file",
              test_file,
              "--shorthand",
              short_name,
              "--mode",
              "predict",
          ]
          test_args = test_args + default_args + extra_args
          logger.info(
              "Running test step with args: {}".format(test_args)
          )
          constituency_parser.main(test_args)
  
      if mode == "parse_text":
          text_args = [
              "--shorthand",
              short_name,
              "--mode",
              "parse_text",
          ]
          text_args = text_args + default_args + extra_args
          logger.info("Processing text with args: {}".format(text_args))
          constituency_parser.main(text_args)
  
file_path: stanza/stanza/utils/training/run_constituency.py
imports: import logging
  import os
  from stanza.models import constituency_parser
  from stanza.models.constituency.retagging import RETAG_METHOD
  from stanza.utils.datasets.constituency import prepare_con_dataset
  from stanza.utils.training import common
  from stanza.utils.training.common import Mode, add_charlm_args, build_charlm_args, choose_charlm, find_wordvec_pretrain
  from stanza.resources.default_packages import default_charlms, default_pretrains
label_desc: Use image node_id 5 for calling a global function with example usage: run_treebank(mode, paths, treebank, short_name, temp_output_file, command_args, extra_args) without return types