semchunk
A Python library for splitting text into smaller chunks while preserving as much local semantic context as possible.
What it is and what it does
semchunk is a Python library that breaks text into smaller, semantically coherent chunks—a critical preprocessing step for retrieval-augmented generation (RAG) and other NLP workflows. It uses a hierarchical chunking algorithm to preserve local semantic context better than simpler splitting strategies. The library is agnostic about tokenization: you can supply any tokenizer (Tiktoken, Hugging Face Transformers, or a custom function) or a simple token counter, and semchunk will respect your token budget while keeping related text together.
The library supports chunk overlapping (by ratio or absolute token count), offset tracking (to map chunks back to source positions), and multiprocessing for batch operations. Optionally, you can enable AI-powered chunking by providing an Isaacus enrichment model name and API key, which uses semantic understanding to make smarter split decisions. It requires only dill and tqdm as dependencies, installs as a pure Python wheel, and supports Python 3.10 through 3.14.
Use it for:
- Prepare documents for RAG pipelines by splitting them into token-bounded chunks that preserve semantic coherence for embedding and retrieval.
- Batch-process large text corpora with multiprocessing, tracking chunk offsets to reconstruct source positions after retrieval.
- Integrate custom tokenizers (e.g., domain-specific or model-specific) into a chunking workflow without rewriting splitting logic.
- Overlap chunks for sliding-window context in language model fine-tuning or evaluation tasks.
- Use AI-powered chunking (via Isaacus) to make semantic split decisions for complex documents like legal or scientific texts.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
semchunk splits text into semantically meaningful chunks while preserving local context, supporting custom tokenizers, chunk overlapping, offsets, and optional AI-powered chunking via the Isaacus API.
Yes. semchunk is production-ready, actively maintained, has no known vulnerabilities, and solves a real problem (semantic text chunking) with low install friction and a permissive license. It is widely used (top 5000 PyPI packages) and offers flexibility via custom tokenizers and optional AI enhancement. Install it if you need to chunk text for RAG, embeddings, or language model workflows.
Install
semchunk on PyPI
pip
pip install semchunkuv
uv add semchunkpoetry
poetry add semchunkInstalling semchunk
Before you install
Low friction: pure Python wheel with only dill and tqdm as runtime dependencies. Actively maintained with recent releases; last commit 2026-06-13. Marked production-ready and used in Docling and the Microsoft Intelligence Toolkit.
License in practice
MIT license (permissive): you can use, modify, and distribute semchunk freely in commercial and private projects without restriction, provided you include the license notice.
Quickstart
pip install semchunk
import semchunk
chunker = semchunk.chunkerify(lambda text: len(text.split()), chunk_size=4)
chunks = chunker('The quick brown fox jumps over the lazy dog.')
print(chunks) # ['The quick brown fox', 'jumps over the', 'lazy dog.']
Requires Python 3.10 or later. For AI-powered chunking, the Isaacus SDK and a valid ISAACUS_API_KEY environment variable are required.
Verify before relying
- Whether the claimed 15% RAG performance improvement over competitors is independently verified or from internal benchmarks.
- Current scale of 'millions of times per month' downloads and whether this refers to semchunk specifically or includes transitive installs.
- Specific performance characteristics (speed, memory usage) for large documents or high-concurrency scenarios.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — dill, tqdm |
| Maintenance | actively maintained — 62 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,936,290/month — #2,444 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: semchunk-4.1.1-py3-none-any.whl
Keywords: ai, chunk, chunker, chunking, chunks, nlp, split, splits, splitter, splitting, text
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
chonkieChonkie splits text into semantically…
permissive · top 5,000 on PyPI
memchunkSplits text into semantic chunks at delimiters…
permissive · top 15,000 on PyPI
semantic-text-splitterSplits long text into semantically meaningful…
permissive · top 15,000 on PyPI
chonkie-corechonkie-core splits text at semantic boundaries…
permissive · top 15,000 on PyPI
tiktokentiktoken is a fast BPE tokenizer that converts…
permissive · top 1,000 on PyPI
aurelio-sdkClient library for the Aurelio Platform that…
unclear · top 15,000 on PyPI
langchain-text-splittersSplits text documents into chunks using a…
permissive · top 1,000 on PyPI
seltzSeltz is a Python SDK that provides web search…
unclear · top 15,000 on PyPI
tensorflow-textTensorFlow Text provides text preprocessing…
permissive · top 5,000 on PyPI
jieba3kPerforms Chinese word segmentation, breaking…
unclear · top 15,000 on PyPI