Sentence Splitter
Split text into sentences, paragraphs, or by custom delimiter. Shows segment count and length statistics.
About this tool
The Sentence Splitter is a practical tool for breaking down text into logical segments—sentences, paragraphs, or custom-delimited chunks. Whether you're analyzing text for research, processing content for NLP tasks, or simply organizing long passages, this tool automatically counts each segment and calculates length statistics, saving you the tedious work of manual parsing.
Simply paste your text into the input field, choose your splitting method (by sentence, paragraph, or custom delimiter), and click Split. The tool instantly displays each segment in a numbered list along with character and word counts, making it easy to identify patterns, compare segment lengths, or export the results for further processing.
This tool is invaluable for writers editing lengthy documents, developers preparing training data for text models, content creators managing article structure, and anyone needing quick text analysis without opening heavy word processors or database tools.
Frequently Asked Questions
Code Implementation
import re
def split_sentences(text):
# Split on .!? followed by space+uppercase (basic sentence detection)
sentences = re.split(r'(?<=[.!?])\s+(?=[A-Z"'])', text.strip())
return [s.strip() for s in sentences if s.strip()]
def split_paragraphs(text):
return [p.strip() for p in re.split(r'\n{2,}', text) if p.strip()]
def split_custom(text, delimiter):
return [p.strip() for p in text.split(delimiter) if p.strip()]
def stats(segments):
if not segments:
return {}
lengths = [len(s) for s in segments]
return {
"total": len(segments),
"avg_length": sum(lengths) // len(lengths),
"longest": max(lengths),
"shortest": min(lengths),
}
text = """Hello world. How are you today? I am doing well!
This is a second group of sentences. They continue here."""
sentences = split_sentences(text)
for i, s in enumerate(sentences, 1):
print(f"{i}. {s}")
print(stats(sentences))Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.