code: def process_raw_annotations(
      anno_dir: str, text_key: str = "semantics", suffix: str = "slu"
  ):
      anno_dir = Path(anno_dir)
  
      splits = [
          "train",
          "train_synthetic",
          "devel",
          "test",
      ]
      id = 0
      for split in splits:
          tag = "_" + suffix if suffix else ""
          new_filename = f"{os.path.join(anno_dir, split)}{tag}.json"
          print(f"Preparing {new_filename}...")
  
          IDs = []
          slurp_id = []
          audio = []
          audio_format = []
          audio_opts = []
  
          semantics = []
          semantics_format = []
          semantics_opts = []
  
          transcript = []
          transcript_format = []
          transcript_opts = []
  
          jsonl_path = os.path.join(anno_dir, split + ".jsonl")
  
          with open(jsonl_path, "r") as fin:
              for line in fin.readlines():
                  line = line.strip()
                  if len(line) == 0:
                      continue
                  obj = json.loads(line)
                  sid = obj["slurp_id"]
                  scenario = obj["scenario"]
                  action = obj["action"]
                  sentence_annotation = obj["sentence_annotation"]
                  num_entities = sentence_annotation.count("[")
                  entities = []
                  for slot in range(num_entities):
                      type = (
                          sentence_annotation.split("[")[slot + 1]
                          .split("]")[0]
                          .split(":")[0]
                          .strip()
                      )
                      filler = (
                          sentence_annotation.split("[")[slot + 1]
                          .split("]")[0]
                          .split(":")[1]
                          .strip()
                      )
                      entities.append(
                          {
                              "type": type.lower(),
                              "filler": filler.lower(),
                          }
                      )
                  for recording in obj["recordings"]:
                      IDs.append(id)
                      slurp_id.append(sid)
                      if "synthetic" in split:
                          audio_folder = "slurp_synth/"
                      else:
                          audio_folder = "slurp_real/"
  
                      path = os.path.join(
                          audio_folder, recording["file"]
                      )
  
                      audio.append(path)
                      audio_format.append("flac")
                      audio_opts.append(None)
  
                      transcript.append(obj["sentence"])
                      transcript_format.append("string")
                      transcript_opts.append(None)
  
                      semantics_dict = {
                          "scenario": scenario,
                          "action": action,
                          "entities": entities,
                      }
  
                      semantics_ = str(semantics_dict)
                      semantics.append(semantics_)
                      semantics_format.append("string")
                      semantics_opts.append(None)
                      id += 1
  
          df = pd.DataFrame(
              {
                  "ID": IDs,
                  "slurp_id": slurp_id,
                  "audio": audio,
                  "semantics": semantics,
                  "transcript": transcript,
              }
          )
  
          if text_key not in ["transcript", "semantics"]:
              text_key = "transcript"
  
          with open(new_filename, "w") as fout:
              for idx in tqdm(range(len(df))):
                  item = {
                      "id": str(df["ID"][idx]),
                      "slurp_id": str(df["slurp_id"][idx]),
                      "audio_filepath": df["audio"][idx],
                      "transcript": df["transcript"][idx],
                      "semantics": df["semantics"][idx],
                      "text": df[text_key][idx],
                  }
                  fout.write(json.dumps(item) + "\n")
          print(f"Saved output to: {new_filename}")
  
file_path: NeMo/scripts/dataset_processing/process_slurp_data.py
imports: import argparse
  import json
  import multiprocessing
  import os
  import tarfile
  from pathlib import Path
  import librosa
  import pandas
  import soundfile
  import wget
  from tqdm import tqdm
  from tqdm.contrib.concurrent import process_map
label_desc: Use image node_id 4 for calling a global function with example usage: process_raw_annotations(anno_dir, text_key, suffix) without return types