msbayindir

Open source · Document processing

rag-chunker

A Node.js pipeline that analyzes PDFs, Office documents, HTML, and images locally, then prepares structured chunks for RAG.

Open source
  • Node.js
  • ONNX
  • TypeScript
Multiple formats
PDF, Office, HTML, and images
Local execution
ONNX for OCR and layout analysis
Traceable output
Markdown, JSON, and JSONL

Data flow

  1. InputPDF · Office · HTML · images
  2. AnalysisLayout · OCR · tables
  3. ChunkingStructured text chunks
  4. RetrievalCandidates and reranking

Technical walkthrough

Problem

Fixed-length chunking can split document context across headings and tables. That makes it harder for document question-answering systems to retrieve the right passage.

Pipeline

Analysis of page layout and reading order comes first. OCR, table extraction, and figure detection prepare the content before it is exported. Text and structural blocks keep their context in Markdown, JSON, and JSONL outputs.

Local execution

ONNX models run layout analysis, OCR, and table recognition locally. Language model and embedding providers are configurable, so teams can use the same pipeline in local prototypes and service-backed deployments.

Retrieval quality

An optional reranking stage reorders candidate passages. The project’s evaluation commands compare BM25, vector, and hybrid search on a fixed set of questions.