2023-05-30 15:11:07 +05:00
|
|
|
from typing import TypedDict, Optional, List
|
2023-05-08 20:45:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2023-05-30 15:11:07 +05:00
|
|
|
words: List[SingleWordSegment]
|
|
|
|
chars: Optional[List[SingleCharSegment]]
|
2023-05-08 20:45:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TranscriptionResult(TypedDict):
|
|
|
|
"""
|
|
|
|
A list of segments and word segments of a speech.
|
|
|
|
"""
|
2023-05-30 15:11:07 +05:00
|
|
|
segments: List[SingleSegment]
|
2023-05-08 20:45:34 +02:00
|
|
|
language: str
|
|
|
|
|
|
|
|
|
|
|
|
class AlignedTranscriptionResult(TypedDict):
|
|
|
|
"""
|
|
|
|
A list of segments and word segments of a speech.
|
|
|
|
"""
|
2023-05-30 15:11:07 +05:00
|
|
|
segments: List[SingleAlignedSegment]
|
|
|
|
word_segments: List[SingleWordSegment]
|