fix skipping null audio and add more verbose logs
parent
a38789d0c3
commit
6f395af10d
|
|
@ -59,9 +59,12 @@ def extract_data(
|
|||
code_wav = code_fb.getvalue()
|
||||
# only starting 1 min audio has reliable alignment ignore rest
|
||||
if start_time > 60:
|
||||
print(f'start time over 60 seconds of audio skipping.')
|
||||
break
|
||||
# only if some reasonable audio data is present yield it
|
||||
if code_seg.duration_seconds >= 0.5:
|
||||
if code_seg.duration_seconds < 0.5:
|
||||
print(f'transcript chunk "{transcript}" contains no audio skipping.')
|
||||
continue
|
||||
yield transcript, code_seg.duration_seconds, code_wav
|
||||
|
||||
def asr_data_generator(call_wav, call_wav_fname, events):
|
||||
|
|
|
|||
|
|
@ -91,7 +91,9 @@ def extract_data(
|
|||
text = "".join(lens["elements"].Each()["value"].collect()(monologue))
|
||||
text_clean = re.sub(r"\[.*\]", "", text)
|
||||
# only if some reasonable audio data is present yield it
|
||||
if tscript_wav_seg.duration_seconds >= 0.5:
|
||||
if tscript_wav_seg.duration_seconds < 0.5:
|
||||
print(f'transcript chunk "{text_clean}" contains no audio in {wav_path} skipping.')
|
||||
continue
|
||||
yield text_clean, tscript_wav_seg.duration_seconds, tscript_wav
|
||||
|
||||
def mono_asr_data_generator(wav_seg, wav_path, meta):
|
||||
|
|
@ -122,6 +124,9 @@ def extract_data(
|
|||
tscript_wav = tscript_wav_fb.getvalue()
|
||||
text = "".join(lens["elements"].Each()["value"].collect()(monologue))
|
||||
text_clean = re.sub(r"\[.*\]", "", text)
|
||||
if tscript_wav_seg.duration_seconds < 0.5:
|
||||
print(f'transcript chunk "{text_clean}" contains no audio in {wav_path} skipping.')
|
||||
continue
|
||||
yield text_clean, tscript_wav_seg.duration_seconds, tscript_wav
|
||||
|
||||
def generate_rev_asr_data():
|
||||
|
|
|
|||
Loading…
Reference in New Issue