A semantic and legal text chunker based on LLM analysis
Project description
LLM Chunker
A flexible, LLM-based text chunker capable of splitting documents based on semantic shifts, legal topics, or emotional flows.
Features
- Semantic Chunking: Splits text where topics actually change, not just by token count.
- Legal Document Support: Specialized prompts for detecting "Purpose", "Definition", "Article" boundaries.
- Pluggable Backend: Supports OpenAI (ChatGPT) by default, but can be used with Ollama or any custom LLM function.
Installation
pip install llm-chunker
Quick Start
import os
from llm_chunker import GenericChunker
# Ensure OPENAI_API_KEY is set
# os.environ["OPENAI_API_KEY"] = "sk-..."
chunker = GenericChunker()
text = "Section 1. Purpose... Section 2. Definitions..."
chunks = chunker.split_text(text)
for chunk in chunks:
print("--- CHUNK ---")
print(chunk)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
llm_chunker-0.1.0.tar.gz
(11.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_chunker-0.1.0.tar.gz.
File metadata
- Download URL: llm_chunker-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc84b9a9ba7a08cd9851703fc0a3908ec7ec5a4d725d549394934462cbd97bc
|
|
| MD5 |
f81833e3ab4ba5afab552b1ea3232f60
|
|
| BLAKE2b-256 |
fc320eff523f0233910d091050ba1b560d18833e7800d7b44747244b8b90ae36
|
File details
Details for the file llm_chunker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_chunker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73ffc93ae43ac542231716b16a5c2a7469d288f15740ff02643e5f2805930008
|
|
| MD5 |
dd164e49e203c4d4058a93d8e767880e
|
|
| BLAKE2b-256 |
a78ebe7dd3883192ee028fc606b36cbd67362947904539f1adf8d43ee57b76da
|