Skip to main content
The SentenceChunker splits text into chunks while preserving complete sentences, ensuring that each chunk maintains proper sentence boundaries and context.

API Reference

To use the SentenceChunker via the API, check out the API reference documentation.

Installation

SentenceChunker is included in the base installation of Chonkie. No additional dependencies are required.
For installation instructions, see the Installation Guide.

Initialization

Parameters

Union[str, Callable, Any]
default:"character"
Tokenizer to use. Can be a string identifier (“character”, “word”, “byte”, “gpt2”, etc.) or a tokenizer instance
int
default:"2048"
Maximum number of tokens per chunk
int
default:"0"
Number of overlapping tokens between chunks
int
default:"1"
Minimum number of sentences to include in each chunk
int
default:"12"
Minimum number of characters per sentence
bool
default:"False"
Use approximate token counting for faster processing.
This field is deprecated and will be removed in future versions.
Union[str, list[str]]
default:"['.', '!', '?', '\\n']"
Delimiters to split sentences on
Optional[Literal["prev", "next"]]
default:"prev"
Specify whether to include the delimiter with the previous or next chunk.

Usage

Single Text Chunking

Batch Chunking

Using as a Callable

Supported Tokenizers

SentenceChunker supports multiple tokenizer backends:
  • TikToken (Recommended)
  • AutoTikTokenizer
  • Hugging Face Tokenizers
  • Transformers

Return Type

SentenceChunker returns chunks as Chunk objects: