JavaScript
6 stars
a powerful Markdown chunking tool that understands document structure. Unlike naive token splitters, it protects atomic elements (code, math, tables), merges by semantic affinity, and scores chunk quality — ready for RAG and fine-tuning workflows.
### Overview: This project is a powerful Markdown chunking tool that intelligently protects atomic elements like code blocks, math formulas, tables, and lists, and scores each chunk based on quality dimensions. It is designed for RAG pipelines and LLM fine-tuning workflows.
### Key Features:
- **Structure-Aware Chunking**: Parses heading hierarchy to build a document outline, then splits and merges sections intelligently.
- **Atomic Element Protection**: Code fences, display/inline math, Markdown tables, HTML tables, and lists are replaced with placeholders before splitting, then restored.
- **5-Dimension Quality Scoring**: Each chunk receives a 0-100 score based on length adequacy, heading presence, sentence completeness, atomic integrity, and content variety.
- **Semantic Affinity Merging**: Short chunks are merged with their most semantically related neighbor using heading-path similarity.
- **Context Preservation**: Sub-chunks receive a `> Context: Chapter > Section > Subsection` blockquote prefix when a section is split.
- **Visual 3-Pane Workspace**: Upload, preview, edit, save, and export chunks through an intuitive web UI.
- **Dual-Mode Usage**: Works both as a standalone web application and as an importable Node.js library function.
- **Export Formats**: JSON and JSONL.
- **i18n**: Full English and Simplified Chinese support with browser language auto-detection.
- **No Database Required**: All storage is file-system based.
### Tech Stack: This project is built with Next.js 14 (App Router),