class_docstr: Librispeech dataset.
class_docstr_tok: ["Librispeech","dataset","."]
docstr: Generate examples from a LibriSpeech archive_path.
docstr_tok: ["Generate","examples","from","a","LibriSpeech","archive_path","."]
code: def _generate_examples(self, files, local_extracted_archive):
      """Generate examples from a LibriSpeech archive_path."""
      key = 0
      audio_data = {}
      transcripts = []
      for path, f in files:
          if path.endswith(".flac"):
              id_ = path.split("/")[-1][: -len(".flac")]
              audio_data[id_] = f.read()
          elif path.endswith(".trans.txt"):
              for line in f:
                  if line:
                      line = line.decode("utf-8").strip()
                      id_, transcript = line.split(" ", 1)
                      audio_file = f"{id_}.flac"
                      speaker_id, chapter_id = [
                          int(el) for el in id_.split("-")[:2]
                      ]
                      audio_file = (
                          os.path.join(
                              local_extracted_archive, audio_file
                          )
                          if local_extracted_archive
                          else audio_file
                      )
                      transcripts.append(
                          {
                              "id": id_,
                              "speaker_id": speaker_id,
                              "chapter_id": chapter_id,
                              "file": audio_file,
                              "text": transcript,
                          }
                      )
          if audio_data and len(audio_data) == len(transcripts):
              for transcript in transcripts:
                  audio = {
                      "path": transcript["file"],
                      "bytes": audio_data[transcript["id"]],
                  }
                  yield key, {"audio": audio, **transcript}
                  key += 1
              audio_data = {}
              transcripts = []
  
file_path: BigDL/python/llm/test/benchmark/whisper/librispeech_asr.py
imports: import os
  import datasets
  from datasets.tasks import AutomaticSpeechRecognition
label_desc: Use image node_id 3 for calling the LibrispeechASR obj's underlying member method code with example usage: obj._generate_examples(files, local_extracted_archive) without return types