Deterministic parent–child chunking for Markdown documents
Project description
Parent Child Chunker
Deterministic parent–child chunking for Markdown documents, designed for Retrieval-Augmented Generation (RAG) pipelines.
This library takes structured Markdown as input and produces:
- parent chunks aligned with document hierarchy
- child chunks optimized for vector search
- explicit, traceable parent–child relationships
The core is lightweight, dependency-free, and framework-agnostic.
Why parent–child chunking?
Naive text splitting often breaks semantic structure and loses context. Parent–child chunking preserves document hierarchy while enabling fine-grained retrieval.
Typical use cases:
- RAG pipelines
- documentation indexing
- knowledge base ingestion
- long-form Markdown processing
What this library does
- Accepts raw Markdown text
- Splits content by header hierarchy
- Normalizes parent chunks by size
- Generates child chunks with stable parent references
- Produces deterministic chunk identifiers
What this library does not do
- PDF or document ingestion
- OCR
- layout reconstruction
- semantic embedding or ranking
Those concerns are intentionally left to upstream tools.
Installation
pip install parent-child-chunker
# OPTIONAL LangChain adapter:
pip install parent-child-chunker[langchain]
Basic usage from parent_child_chunker import ParentChildMarkdownChunker
markdown_text = """
Introduction
This is an introduction.
Background
Some background information.
Details
More detailed content. """
chunker = ParentChildMarkdownChunker( min_parent_chars=500, max_parent_chars=3000, child_chunk_size=512, child_overlap=64, )
parents, children = chunker.chunk(markdown_text)
print(f"Parents: {len(parents)}") print(f"Children: {len(children)}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parent_child_chunker-0.1.0.tar.gz.
File metadata
- Download URL: parent_child_chunker-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21b1725b7196643e53ac3b4fcedae9427ad84f7aa1caba8842763a14e5bef2e8
|
|
| MD5 |
863b41fac3374e03ca7902a4cf93fc9f
|
|
| BLAKE2b-256 |
6e12dbaea6813cafe9c91010a3c8d1ce128dce6346b1a9c84eec6c597f67817d
|
File details
Details for the file parent_child_chunker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: parent_child_chunker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aecbf34c20acea9bf79896aa96790127d79f4bc04a32754d29e5f096e2cba07
|
|
| MD5 |
6fe45d04bddfa66b5e9259c806fe0155
|
|
| BLAKE2b-256 |
29520376cd8461b6dc7db9964a916d714a4712bb66af6c3f399f7b4f6845401b
|