respect verbose flag
parent
6f395af10d
commit
41af0a87de
|
|
@ -59,11 +59,13 @@ def extract_data(
|
||||||
code_wav = code_fb.getvalue()
|
code_wav = code_fb.getvalue()
|
||||||
# only starting 1 min audio has reliable alignment ignore rest
|
# only starting 1 min audio has reliable alignment ignore rest
|
||||||
if start_time > 60:
|
if start_time > 60:
|
||||||
print(f'start time over 60 seconds of audio skipping.')
|
if verbose:
|
||||||
|
print(f'start time over 60 seconds of audio skipping.')
|
||||||
break
|
break
|
||||||
# only if some reasonable audio data is present yield it
|
# 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.')
|
if verbose:
|
||||||
|
print(f'transcript chunk "{transcript}" contains no audio skipping.')
|
||||||
continue
|
continue
|
||||||
yield transcript, code_seg.duration_seconds, code_wav
|
yield transcript, code_seg.duration_seconds, code_wav
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,8 @@ def extract_data(
|
||||||
# print(monologue["speaker_name"])
|
# print(monologue["speaker_name"])
|
||||||
speaker_channel = channel_map.get(monologue["speaker_name"])
|
speaker_channel = channel_map.get(monologue["speaker_name"])
|
||||||
if not speaker_channel:
|
if not speaker_channel:
|
||||||
print(f'unknown speaker tag {monologue["speaker_name"]} in wav:{wav_path} skipping.')
|
if verbose:
|
||||||
|
print(f'unknown speaker tag {monologue["speaker_name"]} in wav:{wav_path} skipping.')
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
start_time = (
|
start_time = (
|
||||||
|
|
@ -79,7 +80,8 @@ def extract_data(
|
||||||
.collect()(monologue)[-1]
|
.collect()(monologue)[-1]
|
||||||
)
|
)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print(f'error when loading timestamp events in wav:{wav_path} skipping.')
|
if verbose:
|
||||||
|
print(f'error when loading timestamp events in wav:{wav_path} skipping.')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# offset by 500 msec to include first vad? discarded audio
|
# offset by 500 msec to include first vad? discarded audio
|
||||||
|
|
@ -92,7 +94,8 @@ def extract_data(
|
||||||
text_clean = re.sub(r"\[.*\]", "", text)
|
text_clean = re.sub(r"\[.*\]", "", text)
|
||||||
# only if some reasonable audio data is present yield it
|
# 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.')
|
if verbose:
|
||||||
|
print(f'transcript chunk "{text_clean}" contains no audio in {wav_path} skipping.')
|
||||||
continue
|
continue
|
||||||
yield text_clean, tscript_wav_seg.duration_seconds, tscript_wav
|
yield text_clean, tscript_wav_seg.duration_seconds, tscript_wav
|
||||||
|
|
||||||
|
|
@ -113,7 +116,8 @@ def extract_data(
|
||||||
.collect()(monologue)[-1]
|
.collect()(monologue)[-1]
|
||||||
)
|
)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print(f'error when loading timestamp events in wav:{wav_path} skipping.')
|
if verbose:
|
||||||
|
print(f'error when loading timestamp events in wav:{wav_path} skipping.')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# offset by 500 msec to include first vad? discarded audio
|
# offset by 500 msec to include first vad? discarded audio
|
||||||
|
|
@ -125,7 +129,8 @@ def extract_data(
|
||||||
text = "".join(lens["elements"].Each()["value"].collect()(monologue))
|
text = "".join(lens["elements"].Each()["value"].collect()(monologue))
|
||||||
text_clean = re.sub(r"\[.*\]", "", text)
|
text_clean = re.sub(r"\[.*\]", "", text)
|
||||||
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.')
|
if verbose:
|
||||||
|
print(f'transcript chunk "{text_clean}" contains no audio in {wav_path} skipping.')
|
||||||
continue
|
continue
|
||||||
yield text_clean, tscript_wav_seg.duration_seconds, tscript_wav
|
yield text_clean, tscript_wav_seg.duration_seconds, tscript_wav
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue