story-shapes
The shape of a novel, Vonnegut-style, read passage by passage by a model that answers with probabilities instead of writing.
Summary
Vonnegut said stories have shapes: how the protagonist fares from the first page to the last. Those curves used to be drawn by scoring the tone of the words, but tone is not fortune. story-shapes asks a model directly, passage by passage, and draws the curve of 29 classics with its uncertainty band.
Stack
- Python: chunking, reading and analysis.
- Kev-4B: an open model that answers with calibrated probabilities instead of text.
- PyTorch: Kev on a Kaggle T4 GPU.
- matplotlib: the curves and the video, generated from the same readings.
Architecture
- Chunk. Each Gutenberg book is split into passages of about 200 words.
- Ask. Kev sees the protagonist’s name and the passage, never the title, and answers how the protagonist is faring (five levels), how much tension there is and whether they appear.
- Draw. The probabilities are smoothed into a curve with a band that includes the model’s doubt.
- Publish. The website shows each book passage by passage, with chapters, tension and what Kev answered.
Notes
- It was measured before building: on passages where tone and fortune disagree, Kev is right 90% of the time and a word list (VADER) 18%.
- The main test fails and is published as such: with the rule fixed in advance, 2 hits in 27 books. Kev almost always points towards the right shape, but one book doesn’t give enough passages to claim it with confidence.