Keep a one-letter or one-digit value instead of dropping it as a bullet - #118
Merged
Merged
Conversation
The last pass of mergeText drops every text block of one character, to spend no tokens on list bullets and separators. A table cell is a block of its own, so a value that is a single digit or letter went too: the Wikipedia infobox for Barack Obama reads "Children" and then "Parents", with the 2 in between gone, and a grade, a count, or a one-character CJK word in a cell vanished the same way. A one-character block is now dropped only when it is not a letter or a digit. Bullets, pipes, and middle dots are punctuation or symbols, so they still go. Co-Authored-By: Claude Opus 5.5 <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.
A value that is a single digit or letter disappears when it sits in a table cell of its own. The Wikipedia infobox for Barack Obama:
oc wiki article Barack_Obama, thenoc read 17 --budget 60:The cause is the last pass of
mergeTextinsrc/distill.js, which drops every text block of one character so that list bullets and separators cost nothing. A cell is a block of its own, so a count, a grade, or a one-character CJK word in a cell went with them. The filter now drops a one-character block only when it is not a letter or a digit (/[\p{L}\p{N}]/u). Bullets, pipes, and middle dots are punctuation or symbols, so they still go.Cost. No fixture page in
tests/pages/changes: same block count and same--statstokens for all 28. On the live Obama article the page goes from 7,125 to 7,127 blocks (the2and oneA), and the first render is ~433 tokens either way. Hacker News's front page is unchanged.Test.
tests/distill.test.jsgains one test: an infobox-shaped table keeps2,A, and是after their labels, and a list of|and•still drops them. Onmainit fails with["Spouse","Michelle Robinson","Children","Grade","Available","Home","About"]. Full suite on Windows (Node 24): 316 tests, 313 pass, 3 skipped, 0 fail.Left alone. A lone symbol that carries meaning in a feature table (
✓,✗) is still dropped, because the same class holds the arrows and stars pages use as decoration. No CHANGELOG line, to keep this round's PRs from conflicting there.🤖 Generated with Claude Code