code: def __process_data(
      dataset_path,
      stat_path_root,
      speaker_id,
      min_duration,
      max_duration,
      val_size,
      test_size,
      seed_for_ds_split,
  ):
      logging.info(f"Preparing JSON split for speaker {speaker_id}.")
      # parse statistic.txt
      stat_path = stat_path_root / "statistic.txt"
      with open(stat_path, "r") as fstat:
          lines = fstat.readlines()
          num_utts = int(lines[4].strip().split()[-1])
          hours = round(float(lines[9].strip().split()[-1]) / 3600.0, 2)
  
      # parse overview.csv to generate JSON splits.
      overview_path = stat_path_root / "overview.csv"
      entries = []
      with open(overview_path, "r") as foverview:
          # Let's skip the header
          foverview.readline()
          for line in tqdm(foverview):
              file_stem, duration, *_, text = line.strip().split("|")
              duration = float(duration)
  
              # file_stem -> dir_name (e.g. maerchen_01_f000051 -> maerchen)
              dir_name = "_".join(file_stem.split("_")[:-2])
              audio_path = (
                  dataset_path / dir_name / "wavs" / f"{file_stem}.wav"
              )
  
              if min_duration <= duration <= max_duration:
                  entry = {
                      "audio_filepath": str(audio_path),
                      "duration": duration,
                      "text": text,
                      "speaker": speaker_id,
                  }
                  entries.append(entry)
  
      random.Random(seed_for_ds_split).shuffle(entries)
      train_size = len(entries) - val_size - test_size
      if train_size <= 0:
          logging.warning(
              f"Skipped speaker {speaker_id}. Not enough data for train, val and test."
          )
          train, val, test, is_skipped = [], [], [], True
      else:
          logging.info(
              f"Preparing JSON split for speaker {speaker_id} is complete."
          )
          train, val, test, is_skipped = (
              entries[:train_size],
              entries[train_size : train_size + val_size],
              entries[train_size + val_size :],
              False,
          )
  
      return {
          "train": train,
          "val": val,
          "test": test,
          "is_skipped": is_skipped,
          "hours": hours,
          "num_utts": num_utts,
      }
  
file_path: NeMo/scripts/dataset_processing/tts/hui_acg/get_data.py
imports: import argparse
  import json
  import random
  import shutil
  import urllib.request
  from pathlib import Path
  import pandas
  from joblib import Parallel, delayed
  from tqdm import tqdm
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling a global function with example usage: __process_data(dataset_path, stat_path_root, speaker_id, min_duration, max_duration, val_size, test_size, seed_for_ds_split) and returns: dict