Registry / ai-ml / chonkie-core

chonkie-core

JSON →
library0.10.2pypypi✓ verified 86d ago

Chonkie Core is a high-performance Python library for semantic text chunking, powered by a Rust backend for speed. It offers various strategies including delimiter-based, size-constrained, and Savitzky-Golay filter-based semantic splitting. The library is actively developed, with frequent releases adding new features and optimizations.

pip install chonkie-core
INSTALL
IMPORT
SIG · CHONKIE-CORE
C
chonkie-core
ai-mlpythonv0.10.2
Install
2.9s avg
Import
Disk
88MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.10.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.9s · import 0.000s · 87MB
88MB installed
● package 88MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Chunker
from chonkie_core import Chunker
from memchunk import Chunker
Package renamed from 'memchunk' to 'chonkie-core' in v0.5.0
chunk
from chonkie_core import chunk
from memchunk import chunk
Package renamed from 'memchunk' to 'chonkie-core' in v0.5.0
chunk_offsets
from chonkie_core import chunk_offsets
from memchunk import chunk_offsets
Package renamed from 'memchunk' to 'chonkie-core' in v0.5.0
merge_splits
from chonkie_core import merge_splits
from memchunk import merge_splits
Package renamed from 'memchunk' to 'chonkie-core' in v0.5.0. Introduced in v0.8.0.
split_at_delimiters
from chonkie_core import split_at_delimiters
from memchunk import split_at_delimiters
Package renamed from 'memchunk' to 'chonkie-core' in v0.5.0. Introduced in v0.6.0.
savgol_filter
from chonkie_core import savgol_filter
from memchunk import savgol_filter
Package renamed from 'memchunk' to 'chonkie-core' in v0.5.0. Savitzky-Golay module introduced in v0.9.0.

Demonstrates basic text chunking using the Chunker class for customizable splitting, the `chunk` convenience function, and retrieving character offsets with `chunk_offsets`. It includes examples using both ASCII and multi-byte delimiters/patterns.

from chonkie_core import Chunker, chunk, chunk_offsets text = "This is the first sentence. This is the second sentence! And this is the third sentence, with a comma. Finally, the last one. Here is some Japanese: これは日本語のテキストです。句読点も含まれます。" # Using Chunker class with delimiters and patterns print("--- Using Chunker ---") chunks_obj = list(Chunker(text, delimiters="\n.?!", patterns=["。", ",", "!"])) for c in chunks_obj: print(f"'{c.text}' (len: {len(c.text)})\nOffset range: {c.offset_range}") # Using convenience function `chunk` print("\n--- Using chunk function ---") for c in chunk(text, delimiters=".", patterns=["。"]): # The 'chunk' function returns Chunk objects print(f"'{c.text}' (len: {len(c.text)})\nOffset range: {c.offset_range}") # Getting offsets directly print("\n--- Using chunk_offsets function ---") offsets = chunk_offsets(text, delimiters=".", patterns=["。"]) print(f"Offsets: {offsets}")
Debug
Known issues
breakingThe package and module name was changed from `memchunk` to `chonkie-core` in version `0.5.0`. Existing `import memchunk` statements will fail.
fix
Update all import statements from `memchunk` to `chonkie_core` (e.g., `from memchunk import Chunker` becomes `from chonkie_core import Chunker`).
affects: >=0.5.0
breakingThe `.patterns()` API for multi-byte delimiter support was introduced for Python in `v0.10.1`. Attempting to use it on earlier versions will result in an `AttributeError`.
fix
Upgrade to `chonkie-core>=0.10.1` to use the `.patterns()` API. For earlier versions, only ASCII delimiters via `.delimiters()` are supported.
affects: <0.10.1
gotchaThe `chunk` and `Chunker` functions primarily operate on string (`str`) inputs. While they can sometimes handle bytes, unexpected behavior or type errors can occur if non-string/bytes types are passed directly.
fix
Ensure the `text` argument passed to `Chunker` or `chunk` is a `str`. If you have byte data, decode it first (e.g., `my_bytes.decode('utf-8')`).
affects: all
gotchaThe Savitzky-Golay filter module, including `savgol_filter` and related functions for semantic chunking, was introduced in `v0.9.0`. These functions internally leverage NumPy for efficient array operations, providing zero-copy performance.
fix
Upgrade to `chonkie-core>=0.9.0` to access the Savitzky-Golay filter module. Although NumPy is not a direct dependency of `chonkie-core` itself, it's highly recommended for optimal performance when using these functions.
affects: <0.9.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'memchunk'
The package name was changed from `memchunk` to `chonkie-core` in version `0.5.0`.
fix
Replace all `import memchunk` statements with `import chonkie_core` (or `from chonkie_core import ...`). Ensure you have `chonkie-core` installed via `pip install chonkie-core`.
AttributeError: 'Chunker' object has no attribute 'patterns'
The `.patterns()` method for multi-byte delimiters was added to the Python bindings in `chonkie-core` version `0.10.1`.
fix
Upgrade your `chonkie-core` installation to `0.10.1` or newer: `pip install --upgrade chonkie-core`.
TypeError: argument 'text': 'int' object cannot be interpreted as a string, expected str
You are passing an integer or another non-string/non-bytes type as the primary text input to a chunking function.
fix
Ensure the `text` argument passed to `Chunker` or `chunk` is a string (`str`) type. For example, `chunk(str(my_int_var))`.
Upgrade
Version history
0.10.2latest on PyPI · released May 28, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
chonkie-core — pip install chonkie-core · libregistry