mirror of
https://github.com/m-bain/whisperX.git
synced 2025-07-01 18:17:27 -04:00
59 lines
1.1 KiB
Python
59 lines
1.1 KiB
Python
from typing import TypedDict, Optional
|
|
|
|
|
|
class SingleWordSegment(TypedDict):
|
|
"""
|
|
A single word of a speech.
|
|
"""
|
|
word: str
|
|
start: float
|
|
end: float
|
|
score: float
|
|
|
|
class SingleCharSegment(TypedDict):
|
|
"""
|
|
A single char of a speech.
|
|
"""
|
|
char: str
|
|
start: float
|
|
end: float
|
|
score: float
|
|
|
|
|
|
class SingleSegment(TypedDict):
|
|
"""
|
|
A single segment (up to multiple sentences) of a speech.
|
|
"""
|
|
|
|
start: float
|
|
end: float
|
|
text: str
|
|
|
|
|
|
class SingleAlignedSegment(TypedDict):
|
|
"""
|
|
A single segment (up to multiple sentences) of a speech with word alignment.
|
|
"""
|
|
|
|
start: float
|
|
end: float
|
|
text: str
|
|
words: list[SingleWordSegment]
|
|
chars: Optional[list[SingleCharSegment]]
|
|
|
|
|
|
class TranscriptionResult(TypedDict):
|
|
"""
|
|
A list of segments and word segments of a speech.
|
|
"""
|
|
segments: list[SingleSegment]
|
|
language: str
|
|
|
|
|
|
class AlignedTranscriptionResult(TypedDict):
|
|
"""
|
|
A list of segments and word segments of a speech.
|
|
"""
|
|
segments: list[SingleAlignedSegment]
|
|
word_segments: list[SingleWordSegment]
|