Phase 1: the spine (segment → layout → encode → render) - #1
Merged
Conversation
End-to-end pipeline on the bundled text, returning a matplotlib Figure. - segment/units.py: segment() over chars/tokens/sentences. Offline, abbreviation- and dialogue-aware regex sentence splitter by default (keeps "Mr. Bennet" and '"Is it let?" she asked.' whole); punkt=True opts into NLTK Punkt. - encode/channels.py: the plain-array data contract — normalize_size, categorical_colors (tab20/hsv, stable by first appearance), continuous_colors, and the Channels container. - layout/linear.py: a trivial reading-order grid layout. - render/mpl.py: render_points and render_path build Figure directly (no pyplot, never show()); equal aspect, framed, headless-safe. - Public API re-exported to the top level; submodule __init__ re-exports. - Tests: unit + Hypothesis property tests per module, plus an end-to-end spine test; examples/spine_demo.py; docs pages and nav. make ci green (57 tests); mkdocs build --strict green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Phase 1 — the spine
Implements the four-step pipeline end to end on the bundled Pride and Prejudice text, returning a matplotlib
Figure.What landed
segment/units.py—segment()overchars/tokens/sentences. Default sentence splitter is self-contained and offline, guarding abbreviations (Mr. Bennet) and dialogue+attribution ("Is it let?" she asked.);punkt=Trueopts into NLTK Punkt.encode/channels.py— the plain-array data contract:normalize_size,categorical_colors(tab20 ≤20 cats, hsv beyond; stable by first appearance),continuous_colors, and theChannelscontainer.layout/linear.py— a trivial reading-order grid layout (the "trivial layout" the spine needs before the richer layouts arrive).render/mpl.py—render_pointsandrender_pathconstructFiguredirectly (nopyplot, nevershow()), equal-aspect and framed, headless-safe.examples/spine_demo.py.Verification
make cigreen: ruff format + lint,ty check, 57 tests (unit + Hypothesis property tests + an end-to-end spine test), 97% coverage.mkdocs build --strictgreen.examples/spine_demo.pysegments the chapter into 59 sentences and renders a tile field.🤖 Generated with Claude Code