class_docstr: Meta data for a kaldi corpus directory. 
class_docstr_tok: ["Meta","data","for","a","kaldi","corpus","directory","."]
docstr: Load meta data from Kaldi data directory. 
docstr_tok: ["Load","meta","data","from","Kaldi","data","directory","."]
code: def load(self, data_path):
      """Load meta data from Kaldi data directory."""
      # TODO: support multiple data directories
      logging.info("Loading Kaldi dir: %s ..." % (data_path))
      self.data_path = data_path
  
      def scp_to_dict(file_path, target_dict, prop):
          """
          Parse a scp file and target_dict[key][prop] = value.
  
          Args:
            file_path: str, path to scp file.
            target_dict: the dict to write to.
            prop: prop name used as dict key.
  
          Return:
            number of lines processed. None if file not found.
          """
          num_lines = 0
          try:
              with open(file_path, "r") as fp_in:
                  for line in fp_in:
                      num_lines += 1
                      tokens = line.strip().split(None, 1)
                      target_dict[tokens[0]][prop] = tokens[1]
              return num_lines
          except FileNotFoundError:
              return None
  
      # Load various scp/ark meta files.
      for file_name, prop_name in self.files_to_load:
          file_path = os.path.join(data_path, file_name)
          num_lines = scp_to_dict(file_path, self.utts, prop_name)
          if num_lines:
              logging.info(
                  "Loaded file %s (key %s) %d lines."
                  % (file_name, prop_name, num_lines)
              )
          else:
              logging.info(
                  "File %s (key %s) failed to load."
                  % (file_name, prop_name)
              )
  
      # Reduce by speaker.
      self.collect_spks_from_utts()
      logging.info("Found %d spks." % (len(self.spks)))
  
      # Load optional speaker -> id file.
      spk2id_path = os.path.join(data_path, "spk2id")
      num_lines = scp_to_dict(spk2id_path, self.spks, "id")
      if num_lines:
          logging.info("Loaded %d spks from spk2id." % (num_lines))
  
      # Sanity check.
      self.validate()
  
file_path: delta/delta/utils/kaldi/kaldi_dir.py
imports: import os
  from collections import defaultdict
  from absl import logging
label_desc: Use image node_id 7 for calling the KaldiMetaData obj's underlying member method code with example usage: obj.load(data_path) and returns: num_lines, None