code: def main():
      input_files = sorted(glob.glob(f"{args.input_dir}/output-*"))
      print("Taking in full: ", input_files[0])
      inst_first_file = read_data_file(input_files[0])
  
      measure_keys = list(MEASURE_PATTERNS.keys())
      for k in measure_keys:
          if (
              re.search("\s?st$", k) is not None
              or re.search("\s?Da$", k) is not None
          ):
              MEASURE_PATTERNS.pop(k)
  
      money_keys = list(MONEY_PATTERNS.keys())
      for k in money_keys:
          if (
              re.search("(DM|SHP|BMD|SCR|SHP|ARS|BWP|SBD)$", k)
              is not None
          ):
              MONEY_PATTERNS.pop(k)
  
      classes_to_upsample["FRACTION"] = sum(
          np.asarray(list(FRACTION_PATTERNS.values())) < args.min_number
      )
      classes_to_upsample["MEASURE"] = sum(
          np.asarray(list(MEASURE_PATTERNS.values())) < args.min_number
      )
      classes_to_upsample["TIME"] = sum(
          np.asarray(list(TIME_PATTERNS.values())) < args.min_number
      )
      classes_to_upsample["MONEY"] = sum(
          np.asarray(list(MONEY_PATTERNS.values())) < args.min_number
      )
  
      print_stats()
      for fp in input_files[1:]:
          print("Upsamling: ", fp)
          instances = read_data_file(fp, upsample_file=True)
          inst_first_file.extend(instances)
          print_stats()
  
      output_f = open(args.output_file, "w+", encoding="utf-8")
      for ix, inst in enumerate(inst_first_file):
          cur_classes, cur_tokens, cur_outputs = inst
          for c, t, o in zip(cur_classes, cur_tokens, cur_outputs):
              output_f.write(f"{c}\t{t}\t{o}\n")
          output_f.write(f"<eos>\t<eos>\n")
  
file_path: NeMo/examples/nlp/duplex_text_normalization/data/en/upsample.py
imports: import glob
  from argparse import ArgumentParser
  from collections import defaultdict
  from typing import List
  import numpy
  import regex
label_desc: Use image node_id 8 for calling a global function with example usage: main() without return types