Configuration Reference — ChunkConfig
On this page
ChunkConfig is a Python dataclass that centralises every tunable parameter in the system. Pass an instance to ChunkManager, or to any individual chunker, to customise behaviour.
from zerda.chunks import ChunkConfig
config = ChunkConfig(
chunk_size=512,
overlap=128,
use_semantic_chunking=True,
)
Table of Contents
- Basic Sizing
- Semantic Chunking
- Adaptive Chunking
- Smart Overlap
- Structure-Aware Chunking
- Context-Aware / Window Merging
- Metadata and Scoring
- Deduplication
- Query-Aware Strategy
- Performance
- Formatting and Text Cleanup
- Tiktoken
- Language-Specific BERT Models
- Transformer Parameters
- Merge Parameters
- Complete Default Reference
Basic Sizing
Tip:
overlapmust be less thanchunk_size. Providingoverlap >= chunk_sizeraisesValueErrorin chunkers that validate inputs.
Semantic Chunking
Adaptive Chunking
Smart Overlap
Structure-Aware Chunking
Context-Aware / Window Merging
Metadata and Scoring
Deduplication
Query-Aware Strategy
Performance
Note:
async_processingandn_workersare declared inChunkConfigbut not yet wired to any async implementation in the current codebase.
Formatting and Text Cleanup
Tiktoken
Language-Specific BERT Models
Pre-configured Hugging Face model names for MultilanguageTextChunker and ArabicTextChunker:
Transformer Parameters
Merge Parameters
Complete Default Reference
from zerda.chunks import ChunkConfig
config = ChunkConfig(
# Basic sizing
chunk_size=512,
overlap=128,
min_chunk_size=50,
max_chunk_size=2048,
strict_size_limit=True,
size_tolerance=0.05,
# Semantic
use_semantic_chunking=False,
semantic_similarity_threshold=0.75,
semantic_model="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
model_name="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
embedding_batch_size=64,
embedding_cache_size=10_000,
# Adaptive
use_adaptive_chunking=False,
adaptive_technical_threshold=0.6,
adaptive_min_size=100,
adaptive_max_size=1500,
adaptive_base_size=512,
# Smart overlap
use_smart_overlap=True,
smart_overlap_threshold=0.7,
# Structure
respect_document_structure=True,
split_on_headers=True,
split_on_paragraphs=True,
preserve_code_blocks=True,
preserve_tables=True,
preserve_lists=True,
# Context window
use_context_window=False,
context_window_size=2,
min_context_sentences=3,
# Metadata
extract_keywords=True,
keyword_max_count=10,
compute_chunk_scores=True,
header_score_boost=1.5,
# Deduplication
deduplication_enabled=True,
dedup_similarity_threshold=0.95,
dedup_use_hash=True,
# Query-aware
query_aware=False,
default_query_pattern="general",
# Performance
async_processing=False,
n_workers=4,
# Formatting
preserve_formatting=True,
fix_spacing=True,
# Tiktoken
model_token="cl100k_base",
# Transformers
max_len=512,
padding=True,
truncation=True,
return_tensor="pt",
)