code: def main(args):
      """
      Read in a .json file of labeled data from AMT, write out a converted .bio file
  
      Enforces that there is only one set of labels on a sentence
      (TODO: add an option to skip certain sets of labels)
      """
      docs = read_json(args.input_path)
  
      if len(docs) == 0:
          print("Error: no documents found in the input file!")
          return
  
      docs = remove_ignored_labels(docs, args.ignore)
      docs = remap_labels(docs, args.remap)
      docs = remove_nesting(docs)
  
      pipe = stanza.Pipeline(args.language, processors="tokenize")
      sentences = []
      for doc in tqdm(docs):
          sentences.extend(process_doc(*doc, pipe))
      print(
          "Found %d total sentences (may be more than #docs if a doc has more than one sentence)"
          % len(sentences)
      )
      bio_filename = args.output_path
      write_sentences(args.output_path, sentences)
      print("Sentences written to %s" % args.output_path)
      if bio_filename.endswith(".bio"):
          json_filename = bio_filename[:-4] + ".json"
      else:
          json_filename = bio_filename + ".json"
      prepare_ner_file.process_dataset(bio_filename, json_filename)
  
file_path: stanza/stanza/utils/datasets/ner/convert_amt.py
imports: import argparse
  import copy
  import json
  from operator import itemgetter
  import sys
  from tqdm import tqdm
  import stanza
  from stanza.utils.datasets.ner.utils import write_sentences
  import stanza.utils.datasets.ner.prepare_ner_file
label_desc: Use image node_id 6 for calling a global function with example usage: main(args) without return types