Back to .md Directory

Splitters

Introduces splitters that divide large text into manageable chunks for AI processing, with configurable sizes and overlap.

May 2, 2026
0 downloads
2 views
ai rag eval
View source

What this file does

Introduces splitters that divide large text into manageable chunks for AI processing, with configurable sizes and overlap.

When to use it

  • Chunking long documents before embedding or retrieval
  • Processing PDFs with images and complex layouts
  • Working with structured Node objects from parsers
  • Splitting text with multiple strategies for different content types

Assumes this stack

Python

Splitters

Splitters are pipeline components that divide large text content into smaller, manageable chunks. They help optimize content for processing, storage, and retrieval in AI applications by creating appropriately sized segments while preserving context and meaning.

Installation

All splitters are included with datapizza-ai-core and require no additional installation.

Available Splitters

Core Splitters (Included by Default)

  • RecursiveSplitter - Recursively divides text using multiple splitting strategies
  • TextSplitter - Basic text splitter for general-purpose chunking
  • NodeSplitter - Splitter for Node objects preserving hierarchical structure
  • PDFImageSplitter - Specialized splitter for PDF content with images

Common Features

  • Multiple splitting strategies for different content types
  • Configurable chunk sizes and overlap
  • Context preservation through overlapping
  • Support for structured content (nodes, PDFs, etc.)
  • Metadata preservation during splitting
  • Spatial layout awareness for document content

Usage Patterns

Basic Text Splitting

from datapizza.modules.splitters import RecursiveSplitter

splitter = RecursiveSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter(long_text_content)

Document Processing Pipeline

from datapizza.modules.parsers import TextParser
from datapizza.modules.splitters import NodeSplitter

parser = TextParser()
splitter = NodeSplitter(max_char = 4000)

document = parser.parse(text_content)
structured_chunks = splitter(document)

Choosing the Right Splitter

  • RecursiveSplitter: Best for general text content, articles, and most use cases
  • TextSplitter: Simple splitting for basic text without complex requirements
  • NodeSplitter: When working with structured Node objects from parsers
  • PDFImageSplitter: Specifically for PDF content with images and complex layouts
  • BBoxMerger: Utility for processing documents with spatial layout information

What's inside

1 overview, 1 installation note, 4 core splitter descriptions, 1 common features list, 2 usage patterns with code examples, 1 choosing guide

Change this for your project

  • Replace datapizza.modules.splitters with your own package import path
  • Replace datapizza.modules.parsers with your own parser module path
  • Replace datapizza-ai-core with your own core package name

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Related Documents