code: def split_sets(speaker_dict, split_ratio):
      """Randomly splits the wav list into training, validation, and test lists.
      Note that a better approach is to make sure that all the classes have the
      same proportion of samples (e.g, spk01 should have 80% of samples in
      training, 10% validation, 10% test, the same for speaker2 etc.). This
      is the approach followed in some recipes such as the Voxceleb one. For
      simplicity, we here simply split the full list without necessarly
      respecting the split ratio within each class.
  
      Arguments
      ---------
      speaker_dict : list
          a dictionary of speaker id and its corresponding audio information
      split_ratio: list
          List composed of three integers that sets split ratios for train,
          valid, and test sets, respectively.
          For instance split_ratio=[80, 10, 10] will assign 80% of the sentences
          to training, 10% for validation, and 10% for test.
  
      Returns
      ------
      dictionary containing train, valid, and test splits.
      """
  
      wav_list = []
      for key in speaker_dict.keys():
          wav_list.extend(speaker_dict[key])
  
      # Random shuffle of the list
      random.shuffle(wav_list)
      tot_split = sum(split_ratio)
      tot_snts = len(wav_list)
      data_split = {}
      splits = ["train", "valid"]
  
      for i, split in enumerate(splits):
          n_snts = int(tot_snts * split_ratio[i] / tot_split)
          data_split[split] = wav_list[0:n_snts]
          del wav_list[0:n_snts]
      data_split["test"] = wav_list
  
      return data_split
  
file_path: speechbrain/recipes/IEMOCAP/quantization/iemocap_prepare.py
imports: import os
  import re
  import json
  import random
  import logging
  from speechbrain.dataio.dataio import read_audio
label_desc: Use image node_id 5 for calling a global function with example usage: split_sets(speaker_dict, split_ratio) and returns: data_split