Repository navigation
Chunk Quality v3.3: Chunkability score + per-chunk flags - #11
Closed
willscott-v2 wants to merge 1 commit into
Closed
willscott-v2 wants to merge 1 commit into
willscott-v2 wants to merge 1 commit into
Conversation
The Chunks view showed structure but passed no judgment — "then what?"
had no answer. This adds the diagnosis layer, all deterministic (regex,
word counts, stoplists, Jaccard shingles, Flesch-Kincaid) — zero AI.
API: analyzeChunks() attaches flags[] and chunk_score to each big chunk
and returns chunkability {score, grade, top_fixes}. Flags:
- dangling-reference: opens with a pronoun (Our/We/This/...)
- near-duplicate: 5-gram Jaccard >= 0.6 between de-overlapped chunks
- no-entity-anchor: no page-entity term (title/site/JSON-LD org/H1 stems
+ initialisms, so "RAG" anchors "Retrieval-augmented generation")
- thin-section (< min(target.min, 100) words), oversized-section,
generic-heading (~40 stoplist), answer-buried (heading vs first
sentence, >= 2 heading content words), readability (FK > 12, info)
Scoring: each chunk starts at 100 and loses its flags' weights; the page
score is the average — proportional to page size by construction.
Extraction fix the near-duplicate flag surfaced: containers wrapping
nested sections were swallowed wholesale into the parent chunk
(Wikipedia "Improvements" contained all of "Encoder"). stopCondition
now treats a container holding the next heading as the boundary, and
heading-bearing containers that never became chunks are skipped.
UI: color-banded score card with top 3 fixes (+N pts each), red/amber/
info flag chips per chunk with fix tooltips, "show only flagged" toggle.
Tuned on 5 real pages: Wikipedia RAG 79/C (highest, as the control
should be) ... Hayes Barton Place 51/F (the page that started all this).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jul 25, 2026
This branch was successfully 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.
Stacked on #10 (v3.2) — merge that first, then retarget this to main.
Why
v3.2 made the Chunks view readable; this answers "now what?". Every page gets a 0–100 Chunkability score and per-chunk fix flags — the actionable layer. Everything is deterministic (regex, word counts, stoplists, Jaccard shingles, Flesch-Kincaid): the same page always scores the same, so you can edit and re-run to watch the delta. Zero AI calls.
API (
api/chunk.js)analyzeChunks()attachesflags[]+chunk_scoreto each big chunk and returns top-levelchunkability {score, grade, top_fixes}.Scoring: each chunk starts at 100 and loses its flags' weights; the page score is the average — proportional to page size by construction, and explainable per chunk.
Extraction fix (root cause, surfaced by the near-duplicate flag)
Containers wrapping nested
<section>s were swallowed wholesale into the parent chunk — Wikipedia's "Improvements" chunk contained the entire "Encoder" subsection, which the flag caught as a 61% duplicate.stopConditionnow treats a container holding the next heading as the section boundary, and heading-bearing containers that never became chunks (nav/aside blocks) are skipped instead of inlined. This was the long-deferred "nested-content extraction" backlog item.UI
Calibration (5 real pages)
Tuning fixes applied along the way: absolute 100-word thin floor (the size-scaled minimum flagged every Wikipedia section), initialism anchors, ≥2-content-word requirement for answer-buried, and the per-chunk-average scoring model (flat deductions punished many-chunk pages).
Next: Phase 3 (v3.4) — BM25 retrieval simulator, query coverage matrix, markdown optimization-report export.
🤖 Generated with Claude Code