MCPcopy Create free account
hub / github.com/allenai/OLMoASR / __init__

Method __init__

olmoasr/utils.py:182–207  ·  view source on GitHub ↗

Initialize TranscriptReader with either file path or transcript string. Args: file_path: Path to transcript file transcript_string: Transcript content as string ext: File extension ('vtt' or 'srt') - required if using transcript_string Raises:

(
        self,
        file_path: Optional[str] = None,
        transcript_string: Optional[str] = None,
        ext: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

180 """
181
182 def __init__(
183 self,
184 file_path: Optional[str] = None,
185 transcript_string: Optional[str] = None,
186 ext: Optional[str] = None,
187 ):
188 """Initialize TranscriptReader with either file path or transcript string.
189
190 Args:
191 file_path: Path to transcript file
192 transcript_string: Transcript content as string
193 ext: File extension ('vtt' or 'srt') - required if using transcript_string
194
195 Raises:
196 ValueError: If neither file_path nor transcript_string is provided
197 """
198 if file_path is None and transcript_string is None:
199 raise ValueError("Either file_path or transcript_string must be provided")
200
201 self.file_path = file_path
202 self.transcript_string = transcript_string
203
204 if file_path is not None:
205 self.ext = file_path.split(".")[-1]
206 else:
207 self.ext = ext
208
209 def _format_timestamp(
210 self, hours: int, minutes: int, seconds: int, milliseconds: int

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected