Metadata-Version: 2.4
Name: parent-child-chunker
Version: 0.1.0
Summary: Deterministic parent–child chunking for Markdown documents
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: langchain
Requires-Dist: langchain-core; extra == "langchain"
Dynamic: license-file

# 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

```bash
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)}")

---

