TherapyNote / utils /text_processing.py
abagherp's picture
Upload folder using huggingface_hub
6830eb0 verified
raw
history blame contribute delete
369 Bytes
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