Breaking Text at Natural Boundaries
May 3, 2026 · blog
I've been thinking about how to group words into caption lines. Every tool I've seen uses fixed word counts — every 5 words, new line. It reads terribly. Natural speech has rhythm, and fixed chunks ignore it completely.
So I'm trying to build something better.
What Makes a Good Break Point?
I watched a bunch of professionally subtitled content and took notes on where human editors break lines. Patterns emerged:
The speaker pauses. This is the strongest signal. If there's a 500ms gap between two words, the speaker intended a break. The caption should break there too.
A sentence ends. Period, question mark, exclamation. Always a break. No exception.
A comma with a pause. Not all commas — "peanut butter, jelly, and bread" shouldn't break at every comma. But "I went to the store, and then I realized" with a slight pause after "store" — that's a natural break.
A clause starts. Words like "but", "so", "because", "although" often start a new thought. But only if the speaker actually pauses before them. "I like cats but not dogs" (no pause) stays together. "I tried everything. But nothing worked" (pause) breaks.
The Hierarchy
I realized these aren't equal — they have priorities. A long pause always wins. A sentence end always wins. But a conjunction only matters if there's actually a gap in the speech.
So I built a 7-rule priority system:
- Pause ≥ 500ms → always break
- Sentence end (
.?!) → always break - Comma + pause ≥ 250ms + at least 3 words already → break
- Hit 42 characters → break (safety limit)
- Hit 7 words → break (safety limit)
- Group spans 2.5+ seconds → break (safety limit)
- Clause starter + pause ≥ 100ms → break
Rules 1–2 are hard. Rules 3 and 7 are soft — they only fire when the speech supports them. Rules 4–6 are safety nets so nothing gets absurdly long.
The Orphan Problem
First version had a bug: sometimes rule 7 would trigger and leave a single word on its own line. "The" sitting alone. "A" sitting alone. Looked terrible.
Fix: even if a rule triggers, don't create a group with just 1 word — unless it's a hard break (pause or sentence end) or the literal last word. This prevents dangling articles and prepositions.
CJK Needs Different Limits
I tested with Japanese and Chinese content. My 42-character limit produced lines that overflowed the screen. CJK glyphs are roughly double-width — each character takes the space of two Latin characters.
So the character limit drops to 20 for CJK text. Detection is a simple Unicode range check: \u4e00-\u9fff for CJK unified ideographs, plus Hiragana, Katakana, and Hangul ranges.
First Results
It's working. Captions break at places that feel natural when you read them. Sentences stay together. Pauses get respected. No more mid-thought line breaks.
But I'm already seeing a new problem: some groups have way too many characters per second. Fast speakers produce groups that are technically correct (good break points) but impossible to read in time. I think I need a reading speed check on top of this.
More on that next time.