Repository navigation
fix(chunklets): stop one-line paragraphs from collapsing boundary cues - #6
Merged
Merged
Conversation
A one-line paragraph holding several sentences leaked paragraph_open strength to every interior sentence, leaving no zero-probability separators between blocks. SPEC-CHUNK-241 suppression then collapsed the whole document to a single surviving boundary, discarding every heading/paragraph cue after the first. Add a block-opener guard in _per_sentence_boundary_probas so only the sentence that opens a block earns the structural strength. Restores paragraph-aligned splits, keeps abstracts whole (break at ## Introduction), and prevents headings from being stranded at a chunk's tail. Update SPEC-CHUNK-240 + add TV-209; regression tests for paragraph boundary, heading-tail/stub, and abstract-whole. Bump to 0.6.1. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
emerose
force-pushed
the
claude/keen-thompson-7aff6f
branch
from
May 29, 2026 12:54
0a2243b to
ae72a97
Compare
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a stage-2 root cause in boundary-cue assignment that surfaced in the chunk-coherence review (Qasper papers, ~1700-char target). Rebased onto current
main(v0.6.0); this releases as 0.6.1._per_sentence_boundary_probasassignedparagraph_openstrength to every sentence sharing a one-line paragraph's source line (the normal Qasper shape). With no0.0separators between blocks, SPEC-CHUNK-241 suppression then collapsed the whole document to a single surviving boundary, discarding every heading and paragraph cue after the first.The fix adds a block-opener guard: only the sentence whose first non-whitespace character actually opens the block earns the structural strength; interior sentences score
0.0.Relationship to existing work
mainalready added stage-3 mechanisms — SPEC-CHUNK-324 (MID_PARAGRAPH_PENALTY) and SPEC-CHUNK-323 (small-chunk badness). Those operate on the partition objective; they depend on stage 2 actually emitting the paragraph/heading cues. This fix restores those cues at the source, so the stage-3 preferences fire as intended.chunklets.pywas untouched by main, so this is complementary, not overlapping.Restored behavior:
\n\nboundary is within budget).## Introduction.Verified across the 7 reported papers: 0 heading-tails, 0 stubs.
Issue 5 (the
, whichmid-clause split in 1912.11637) was investigated and is a source-data artifact — the raw Qasper markdown contains a stray. ,("...CIDEr. , which..."); SaT correctly splits at the genuine period. No code change.Changes
src/fancychunk/chunklets.py— block-opener guard in_per_sentence_boundary_probas.docs/specs/02-chunklet-grouping.md— SPEC-CHUNK-240 documents the guard.docs/specs/test-vectors/02-chunklet-grouping.md— new TV-209.Test plan
uv run pytest -q— 212 passed, 20 skipped (on the rebased base)uv run ruff checkclean on touched files; my edits format-cleanuv run pyright— 0 errors🤖 Generated with Claude Code