moodlens-api / app /utils /sequence_splitter.py
kpatel1607's picture
Upload folder using huggingface_hub
1320be7 verified
Raw
History Blame Contribute Delete
305 Bytes
import re
def split_sentences(text: str):
text = str(text).strip()
if not text:
return []
sentences = re.split(
r"(?<=[.!?])\s+",
text
)
return [
sentence.strip()
for sentence in sentences
if sentence.strip()
]