mirror of
https://github.com/QuentinFuxa/WhisperLiveKit.git
synced 2026-03-08 06:44:09 +00:00
28 lines
658 B
Python
28 lines
658 B
Python
from dataclasses import dataclass
|
|
from typing import Optional
|
|
|
|
@dataclass
|
|
class TimedText:
|
|
start: Optional[float]
|
|
end: Optional[float]
|
|
text: Optional[str] = ''
|
|
speaker: Optional[int] = -1
|
|
probability: Optional[float] = None
|
|
|
|
@dataclass
|
|
class ASRToken(TimedText):
|
|
def with_offset(self, offset: float) -> "ASRToken":
|
|
"""Return a new token with the time offset added."""
|
|
return ASRToken(self.start + offset, self.end + offset, self.text, self.speaker, self.probability)
|
|
|
|
@dataclass
|
|
class Sentence(TimedText):
|
|
pass
|
|
|
|
@dataclass
|
|
class Transcript(TimedText):
|
|
pass
|
|
|
|
@dataclass
|
|
class SpeakerSegment(TimedText):
|
|
pass |