Download app/utils/sequence_splitter.py from kpatel1607/moodlens-api: direct link, hf CLI and curl.
- Browser
- Download file 305 Bytes
-
https://huggingface.co/kpatel1607/moodlens-api/resolve/main/app/utils/sequence_splitter.py
- Command line
-
hf download hf://kpatel1607/moodlens-api/app/utils/sequence_splitter.py
-
curl -L -o sequence_splitter.py https://huggingface.co/kpatel1607/moodlens-api/resolve/main/app/utils/sequence_splitter.py
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() | |
| ] |