Troubleshooting
On this page
Chunks Are Too Short
Symptom: Many chunks with char_count < 50.
Causes:
min_chunk_sizeis set too low (default 50).- Input has many short paragraphs or single-sentence sections.
Fix:
config = ChunkConfig(min_chunk_size=150)
Or merge short chunks post-hoc:
min_len = 100
merged = [c for c in chunks if c.char_count >= min_len]
Chunks Are Too Large
Symptom: Single chunk containing the entire document.
Causes:
similarity_thresholdis too low (semantic mode).- Text has no paragraph breaks (structural mode).
max_chunk_sizeis set very high.
Fix:
# Lower threshold → more chunks
chunker = SemanticChunker(similarity_threshold=0.85)
# Add structural splits
config = ChunkConfig(
respect_document_structure=True,
split_on_paragraphs=True,
)
No Keywords Extracted
Symptom: chunk.metadata.keywords == [] and chunk.metadata.score == 0.0.
Cause: Using a chunker directly without MetadataEnricher.
Fix: Use ChunkManager (runs enrichment automatically), or:
from zerda.chunks import MetadataEnricher
enricher = MetadataEnricher()
enricher.enrich(chunks)
Arabic Text Not Split Correctly
Symptom: All Arabic text in one chunk, or splits in wrong places.
Causes:
- Missing spacing around Arabic punctuation (common in OCR text).
- Not using
ArabicTextChunker.
Fix:
from zerda.chunks import ArabicTextChunker
chunker = ArabicTextChunker(fix_spacing=True, chunk_size=400)
Or add normalization:
from zerda.chunks import ArabicNormalizer, NormalizingChunkerWrapper, ArabicTextChunker
wrapper = NormalizingChunkerWrapper(
ArabicTextChunker(fix_spacing=True),
normalizer=ArabicNormalizer(),
)
chunks = wrapper.chunk(text)
Semantic Chunking Falls Back to TF-IDF
Symptom: You set use_semantic_chunking=True but chunks don't look semantically grouped.
Cause: sentence-transformers not installed → TF-IDF fallback activates silently.
Fix:
pip install sentence-transformers torch
ValueError: overlap >= chunk_size
Cause: ChunkConfig(overlap=512, chunk_size=256).
Fix: Ensure overlap < chunk_size.
config = ChunkConfig(chunk_size=512, overlap=128) # overlap must be < chunk_size
HTML Not Parsed Correctly
Symptom: HTML tags appearing as raw text in chunks.
Cause: beautifulsoup4 not installed; parser falls back to regex tag stripper.
Fix:
pip install beautifulsoup4
Empty List Returned
Symptom: manager.process(text) returns [].
Causes:
textis empty or whitespace-only.- All chunks shorter than
min_chunk_sizewere dropped.
Fix:
if not text.strip():
print("Empty text!")
else:
config = ChunkConfig(min_chunk_size=10) # lower the floor
chunks = ChunkManager(config=config).process(text)
→ FAQ →
→ Architecture →