mirror of
https://github.com/m-bain/whisperX.git
synced 2025-07-01 18:17:27 -04:00
Update alignment.py
This commit is contained in:
@ -98,7 +98,8 @@ def align(
|
|||||||
device: str,
|
device: str,
|
||||||
interpolate_method: str = "nearest",
|
interpolate_method: str = "nearest",
|
||||||
return_char_alignments: bool = False,
|
return_char_alignments: bool = False,
|
||||||
print_progress = False
|
print_progress = False,
|
||||||
|
combined_progress = False
|
||||||
) -> AlignedTranscriptionResult:
|
) -> AlignedTranscriptionResult:
|
||||||
"""
|
"""
|
||||||
Align phoneme recognition predictions to known transcription.
|
Align phoneme recognition predictions to known transcription.
|
||||||
@ -124,7 +125,8 @@ def align(
|
|||||||
for sdx, segment in enumerate(transcript):
|
for sdx, segment in enumerate(transcript):
|
||||||
# strip spaces at beginning / end, but keep track of the amount.
|
# strip spaces at beginning / end, but keep track of the amount.
|
||||||
if print_progress:
|
if print_progress:
|
||||||
percent_complete = ((sdx + 1) / total_segments) * 100
|
base_progress = ((sdx + 1) / total_segments) * 100
|
||||||
|
percent_complete = (50 + base_progress / 2) if combined_progress else base_progress
|
||||||
print(f"Progress: {percent_complete:.2f}%...")
|
print(f"Progress: {percent_complete:.2f}%...")
|
||||||
|
|
||||||
num_leading = len(segment["text"]) - len(segment["text"].lstrip())
|
num_leading = len(segment["text"]) - len(segment["text"].lstrip())
|
||||||
|
Reference in New Issue
Block a user