BrunoHays commited on
Commit
62caef0
·
1 Parent(s): e39f8e2

Update ESLO.py

Browse files
Files changed (1) hide show
  1. ESLO.py +14 -13
ESLO.py CHANGED
@@ -389,16 +389,17 @@ class ESLO(datasets.GeneratorBasedBuilder):
389
  for path in transcripts:
390
  transcript_name = os.path.splitext(os.path.basename(path))[0]
391
  audio = self.load_audio(audio_files[transcript_name])
392
- for utterance in self.load_one(path):
393
- if not self.config.overlap and utterance.overlap:
394
- continue
395
- yield f"{transcript_name}_{utterance.start_timestamp}-{utterance.end_timestamp}", {
396
- "file": transcript_name,
397
- "sentence": utterance.sentence,
398
- "start_timestamp": utterance.start_timestamp,
399
- "end_timestamp": utterance.end_timestamp,
400
- "speaker": utterance.speaker,
401
- "overlap": utterance.overlap,
402
- "audio": {"path": transcript_name,
403
- "array": self._cut_audio(audio, utterance.start_timestamp, utterance.end_timestamp),
404
- "sampling_rate": 16000}}
 
 
389
  for path in transcripts:
390
  transcript_name = os.path.splitext(os.path.basename(path))[0]
391
  audio = self.load_audio(audio_files[transcript_name])
392
+ with open(path, "r") as file:
393
+ for utterance in self.load_one(file):
394
+ if not self.config.overlap and utterance.overlap:
395
+ continue
396
+ yield f"{transcript_name}_{utterance.start_timestamp}-{utterance.end_timestamp}", {
397
+ "file": transcript_name,
398
+ "sentence": utterance.sentence,
399
+ "start_timestamp": utterance.start_timestamp,
400
+ "end_timestamp": utterance.end_timestamp,
401
+ "speaker": utterance.speaker,
402
+ "overlap": utterance.overlap,
403
+ "audio": {"path": transcript_name,
404
+ "array": self._cut_audio(audio, utterance.start_timestamp, utterance.end_timestamp),
405
+ "sampling_rate": 16000}}