Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1Panel dev MaxKB Document Splitting

From Leeroopedia
Knowledge Sources
Domains RAG, NLP
Last Updated 2026-10-10 00:00 GMT

Overview

A text processing technique that decomposes documents into smaller, semantically coherent units (paragraphs) for independent embedding and retrieval.

Description

Document splitting is the first step in the RAG pipeline. Raw documents (PDF, DOC, CSV, TXT, etc.) are parsed and broken into paragraphs that can be individually embedded and stored in a vector database. The key challenge is maintaining semantic coherence: splits should preserve complete ideas rather than cutting mid-sentence. MaxKB uses a format-detection approach where registered handlers (`split_handles`) each claim specific file types via `support()`, then implement format-specific parsing. Splitting parameters include `limit` (max characters per paragraph, default 4096), `pattern_list` (custom regex patterns), and `with_filter` (content filtering flag).

Usage

Use this principle when designing:

  • Document ingestion pipelines for knowledge bases
  • Text chunking strategies for embedding models
  • Multi-format document parsing systems

Theoretical Basis

The core trade-off in document splitting is between recall and precision:

  • Too-large chunks — Embeddings average over too much content, reducing retrieval precision for specific queries
  • Too-small chunks — Context is lost, reducing the embedding's ability to capture semantic meaning

The optimal chunk size depends on the embedding model's context window and the domain's information density. MaxKB defaults to 4096 characters, which balances these concerns for general-purpose text.

# Abstract algorithm description (NOT real implementation)
for handler in split_handles:
    if handler.supports(file_format):
        paragraphs = handler.split(
            file,
            max_chars=limit,         # 4096
            patterns=pattern_list,   # Optional regex splits
            filter=with_filter,      # Content filtering
        )
        break
# Each paragraph: {"content": str, "title": str, "source_file_id": str}

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment