code: def main(in_directory, out_directory, short_name):
      os.makedirs(out_directory, exist_ok=True)
  
      input_path = os.path.join(
          in_directory, "scare_v1.0.0_text", "annotations", "*txt"
      )
      text_files = glob.glob(input_path)
      if len(text_files) == 0:
          raise FileNotFoundError(
              "Did not find any input files in %s" % input_path
          )
      else:
          print(
              "Found %d input files in %s"
              % (len(text_files), input_path)
          )
      text_id_map = {}
      for filename in text_files:
          with open(filename) as fin:
              for line in fin.readlines():
                  line = line.strip()
                  if not line:
                      continue
                  key, value = line.split(maxsplit=1)
                  if key in text_id_map:
                      raise ValueError("Duplicate key {}".format(key))
                  text_id_map[key] = value
  
      print("Found %d total sentiment ratings" % len(text_id_map))
      nlp = stanza.Pipeline("de", processors="tokenize")
      snippets = get_scare_snippets(
          nlp,
          os.path.join(in_directory, "scare_v1.0.0", "annotations"),
          text_id_map,
      )
  
      print(len(snippets))
      process_utils.write_list(
          os.path.join(out_directory, "%s.train.json" % short_name),
          snippets,
      )
  
file_path: stanza/stanza/utils/datasets/sentiment/process_scare.py
imports: import csv
  import glob
  import os
  import sys
  import stanza
  from stanza.models.classifiers.data import SentimentDatum
  import stanza.utils.datasets.sentiment.process_utils
label_desc: Use image node_id 2 for calling a global function with example usage: main(in_directory, out_directory, short_name) without return types