How to get alignment metrics from result? #369
-
When |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The fail count is not stored in the result but you can recount it. The segment/word is considered as failed if the stable-ts/stable_whisper/alignment.py Line 702 in 6826786 The words that failed to aligned at the end of an audio clip have their end and start set to the audio duration.
# failed segments / total segments
failed_segments = len([None for seg in result.segments if seg.end-seg.start <= 0])
print(f'Failed segments: {failed_segments}/{len(result.segments)}')
# failed words / total words
all_words = result.all_words()
failed_words = len([None for word in all_words if word.end-word.start <= 0])
print(f'Failed words: {failed_words}/{len(all_words)}')
# remaining words that failed to align / total words
last_failed_words = 0
for word in reversed(all_words):
if word.end == word.start:
last_failed_words += 1
else:
break
print(f'Failed remaining words: {last_failed_words}/{len(all_words)}') |
Beta Was this translation helpful? Give feedback.
The fail count is not stored in the result but you can recount it. The segment/word is considered as failed if the
end
-start
<=0
.Note that this different from the
duration
attribute of the segment/word becauseduration
isend
-start
rounded to 3 decimals.stable-ts/stable_whisper/alignment.py
Line 702 in 6826786
The words that failed to aligned at the end of an audio clip have their
end
andstart
set to the audio duration.