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

Function discover_transcript_files

scripts/data/processing/text_to_jsonl.py:167–191  ·  view source on GitHub ↗

Discover transcript files in a directory. Args: input_path: Directory path to search pattern: File pattern to match (default: "*.*t" for .srt, .vtt, .txt, etc.) Returns: List of transcript file paths Raises: ValueError: If no transcript files are f

(input_path: FilePath, pattern: str = "*.*t")

Source from the content-addressed store, hash-verified

165
166
167def discover_transcript_files(input_path: FilePath, pattern: str = "*.*t") -> FileList:
168 """
169 Discover transcript files in a directory.
170
171 Args:
172 input_path: Directory path to search
173 pattern: File pattern to match (default: "*.*t" for .srt, .vtt, .txt, etc.)
174
175 Returns:
176 List of transcript file paths
177
178 Raises:
179 ValueError: If no transcript files are found
180 """
181 if not os.path.isdir(input_path):
182 raise ValueError(f"Input path is not a directory: {input_path}")
183
184 files = glob.glob(os.path.join(input_path, pattern))
185
186 if not files:
187 raise ValueError(
188 f"No transcript files found in {input_path} with pattern {pattern}"
189 )
190
191 return sorted(files)
192
193
194def prepare_input_files(input_path: Union[str, List[str]]) -> FileList:

Callers 1

prepare_input_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected