code: def main():
      """
      Turn the train section of VI quad into a list of trees
      """
      args = parse_args()
  
      docs = read_quad(args.input_file)
      logger.info("Read %d lines from %s", len(docs), args.input_file)
      if args.tokenize_only:
          pipe = stanza.Pipeline(args.lang, processors="tokenize")
          text = selftrain.tokenize_docs(
              docs, pipe, args.min_len, args.max_len
          )
          with open(args.output_file, "w", encoding="utf-8") as fout:
              for line in text:
                  fout.write(line)
                  fout.write("\n")
      else:
          tag_pipe = selftrain.build_tag_pipe(
              ssplit=False, lang=args.lang
          )
          parser_pipes = selftrain.build_parser_pipes(
              args.lang, args.models
          )
  
          # create a blank file.  we will append to this file so that partial results can be used
          with open(args.output_file, "w") as fout:
              pass
  
          accepted_trees = set()
          new_trees = selftrain.find_matching_trees(
              docs,
              args.num_sentences,
              accepted_trees,
              tag_pipe,
              parser_pipes,
              shuffle=False,
              chunk_size=100,
          )
          new_trees = [
              tree for tree in new_trees if tree.find("(_SQ") >= 0
          ]
          with open(args.output_file, "a") as fout:
              for tree in sorted(new_trees):
                  fout.write(tree)
                  fout.write("\n")
  
file_path: stanza/stanza/utils/datasets/constituency/selftrain_vi_quad.py
imports: import argparse
  import json
  import logging
  import stanza
  from stanza.utils.datasets.constituency import selftrain
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types