Skip to content

Chunk Quality v3.3: Chunkability score + per-chunk flags - #14

Merged
willscott-v2 merged 1 commit into
mainfrom
feature/chunk-quality-v3.3
Jul 25, 2026
Merged

willscott-v2 merged 1 commit into
mainfrom
feature/chunk-quality-v3.3

Conversation

@willscott-v2

Copy link
Copy Markdown
Collaborator

Replaces #11, which was auto-closed when its base branch was deleted during the #10 merge — identical content, full description in #11.

🤖 Generated with Claude Code

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>
@willscott-v2
willscott-v2 merged commit ee984e4 into main Jul 25, 2026
5 checks passed
@willscott-v2
willscott-v2 deleted the feature/chunk-quality-v3.3 branch July 25, 2026 21:21

This branch was successfully deployed

1 active deployment
Preview — d2e0f86b Deployed Jul 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant