Spaces:
Sleeping
Sleeping
from __future__ import annotations | |
def chunk_text(text: str, chunk_size: int = 3000) -> list[str]: | |
""" | |
Simple utility to chunk text into manageable pieces if needed | |
for long transcripts. | |
""" | |
words = text.split() | |
chunks = [] | |
for i in range(0, len(words), chunk_size): | |
chunks.append(" ".join(words[i:i+chunk_size])) | |
return chunks |