chunklet-py 2.2.0__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/PKG-INFO +42 -23
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/README.md +29 -16
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/pyproject.toml +22 -11
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/__init__.py +5 -3
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/base_chunker.py +9 -9
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/code_chunker/_code_structure_extractor.py +87 -90
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/code_chunker/code_chunker.py +112 -113
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/code_chunker/utils.py +15 -16
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/batch_runner.py +9 -9
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/deprecation.py +4 -4
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/path_utils.py +8 -8
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/token_utils.py +6 -3
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/validation.py +33 -41
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/_plain_text_chunker.py +117 -165
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/converters/html_2_md.py +9 -10
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/converters/latex_2_md.py +19 -22
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/converters/rst_2_md.py +5 -8
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/converters/table_2_md.py +3 -8
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/document_chunker.py +102 -106
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/processors/base_processor.py +3 -3
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/processors/docx_processor.py +6 -7
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/processors/epub_processor.py +4 -4
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/processors/odt_processor.py +5 -4
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/processors/pdf_processor.py +17 -18
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/registry.py +47 -47
- chunklet_py-2.3.0/src/chunklet/document_chunker/span_finder.py +83 -0
- chunklet_py-2.3.0/src/chunklet/sentence_splitter/_universal_splitter.py +121 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/sentence_splitter/languages.py +3 -2
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/sentence_splitter/registry.py +43 -43
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/sentence_splitter/sentence_splitter.py +95 -70
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/sentence_splitter/terminators.py +5 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/visualizer/static/index.html +1 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/visualizer/static/js/app.js +6 -2
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/visualizer/visualizer.py +47 -14
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet_py.egg-info/PKG-INFO +42 -23
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet_py.egg-info/SOURCES.txt +2 -1
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet_py.egg-info/requires.txt +16 -4
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/tests/test_plain_text_chunking.py +31 -2
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/tests/test_sentence_splitting.py +23 -5
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/tests/test_visualization.py +59 -26
- chunklet_py-2.2.0/src/chunklet/sentence_splitter/_fallback_splitter.py +0 -112
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/LICENSE +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/setup.cfg +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/cli.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/code_chunker/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/code_chunker/patterns.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/common/logging_utils.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/converters/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/document_chunker/processors/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/exceptions.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/sentence_splitter/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/visualizer/__init__.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/visualizer/static/css/style.css +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet/visualizer/static/js/utils.js +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet_py.egg-info/dependency_links.txt +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet_py.egg-info/entry_points.txt +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/src/chunklet_py.egg-info/top_level.txt +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/tests/test_code_chunking.py +0 -0
- {chunklet_py-2.2.0 → chunklet_py-2.3.0}/tests/test_document_chunking.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chunklet-py
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: High-fidelity context-aware chunking and interactive visualization for RAG. Advanced segmentation for code and documents, because your LLM is only as smart as the fragments you feed it.
|
|
5
5
|
Author-email: speedyk_005 <speedy40115719@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,7 +15,6 @@ Classifier: Intended Audience :: Developers
|
|
|
15
15
|
Classifier: Intended Audience :: Science/Research
|
|
16
16
|
Classifier: Intended Audience :: Information Technology
|
|
17
17
|
Classifier: Operating System :: OS Independent
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -23,21 +22,24 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
23
22
|
Classifier: Topic :: Text Processing
|
|
24
23
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
-
Requires-Python: >=3.
|
|
25
|
+
Requires-Python: >=3.11
|
|
27
26
|
Description-Content-Type: text/markdown
|
|
28
27
|
License-File: LICENSE
|
|
28
|
+
Requires-Dist: loguru<1.0,>=0.7.3
|
|
29
29
|
Requires-Dist: pysbd<1.0,>=0.3.4
|
|
30
30
|
Requires-Dist: sentsplit<2.0,>=1.0.8
|
|
31
|
-
Requires-Dist: sentencex
|
|
31
|
+
Requires-Dist: sentencex<2.0,>=1.0.0; platform_system != "Android"
|
|
32
|
+
Requires-Dist: sentencex<=0.6.1; platform_system == "Android"
|
|
32
33
|
Requires-Dist: indic-nlp-library<1.0,>=0.92
|
|
33
34
|
Requires-Dist: py3langid<1.0,>=0.3.0
|
|
34
35
|
Requires-Dist: mpire<3.0,>=2.10.2
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist: more-itertools<
|
|
36
|
+
Requires-Dist: dotdict3<2.0,>=1.1.0
|
|
37
|
+
Requires-Dist: more-itertools<12.0,>=10.6.0
|
|
37
38
|
Requires-Dist: regex>=2025.7.29
|
|
38
|
-
Requires-Dist: pydantic<3.0,>=2.11.
|
|
39
|
+
Requires-Dist: pydantic<3.0,>=2.11.0
|
|
39
40
|
Requires-Dist: typer<1.0,>=0.19.0
|
|
40
41
|
Requires-Dist: charset-normalizer<4.0,>=3.4.2
|
|
42
|
+
Requires-Dist: setuptools<81
|
|
41
43
|
Provides-Extra: structured-document
|
|
42
44
|
Requires-Dist: pdfminer.six>=20250324; extra == "structured-document"
|
|
43
45
|
Requires-Dist: python-docx<2.0,>=1.2.0; extra == "structured-document"
|
|
@@ -59,13 +61,17 @@ Provides-Extra: visualization
|
|
|
59
61
|
Requires-Dist: uvicorn<1.0,>=0.35.0; extra == "visualization"
|
|
60
62
|
Requires-Dist: fastapi<1.0,>=0.116.0; extra == "visualization"
|
|
61
63
|
Requires-Dist: python-multipart<1.0,>=0.0.20; extra == "visualization"
|
|
64
|
+
Requires-Dist: msgpack<2.0,>=1.1.0; extra == "visualization"
|
|
62
65
|
Requires-Dist: aiofiles==25.1.0; extra == "visualization"
|
|
66
|
+
Provides-Extra: viz
|
|
67
|
+
Requires-Dist: chunklet-py[visualization]; extra == "viz"
|
|
63
68
|
Provides-Extra: all
|
|
64
69
|
Requires-Dist: chunklet-py[code,structured-document,visualization]; extra == "all"
|
|
65
70
|
Provides-Extra: dev
|
|
66
71
|
Requires-Dist: pytest>=8.3.5; extra == "dev"
|
|
67
72
|
Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
|
|
68
73
|
Requires-Dist: pytest-mock>=3.14.1; extra == "dev"
|
|
74
|
+
Requires-Dist: pytest-timeout>=2.3.1; extra == "dev"
|
|
69
75
|
Requires-Dist: ruff>=0.14.14; extra == "dev"
|
|
70
76
|
Provides-Extra: docs
|
|
71
77
|
Requires-Dist: mike>=2.1.2; extra == "docs"
|
|
@@ -80,17 +86,14 @@ Dynamic: license-file
|
|
|
80
86
|
# 🧩 Chunklet-py
|
|
81
87
|
|
|
82
88
|
<p align="center">
|
|
83
|
-
<img src="https://github.com/speedyk-005/chunklet-py/blob/main/logo_with_tagline.
|
|
89
|
+
<img src="https://github.com/speedyk-005/chunklet-py/blob/main/logo_with_tagline.svg?raw=true" alt="Chunklet-py Logo" width="300"/>
|
|
84
90
|
</p>
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
>
|
|
89
|
-
> **Quick heads up!** Version 2 has some breaking changes. No worries though - check our [Migration Guide](https://speedyk-005.github.io/chunklet-py/latest/migration/) for a smooth upgrade!
|
|
90
|
-
|
|
91
|
-
Hey! Welcome. Let's make some text chunking magic happen.
|
|
92
|
+
<p align="center">
|
|
93
|
+
“One library to split them all: Sentence, Code, Docs”
|
|
94
|
+
</p>
|
|
92
95
|
|
|
93
|
-
[](https://www.python.org/downloads/)
|
|
94
97
|
[](https://pypi.org/project/chunklet-py)
|
|
95
98
|
[](https://pepy.tech/projects/chunklet-py)
|
|
96
99
|
[](https://coveralls.io/github/speedyk-005/chunklet-py?branch=main)
|
|
@@ -100,6 +103,13 @@ Hey! Welcome. Let's make some text chunking magic happen.
|
|
|
100
103
|
[](https://www.codefactor.io/repository/github/speedyk-005/chunklet-py)
|
|
101
104
|
[](https://deepwiki.com/speedyk-005/chunklet-py)
|
|
102
105
|
|
|
106
|
+
> [!WARNING]
|
|
107
|
+
> **Quick heads up!** Version 2 has some breaking changes. No worries though - check our [Migration Guide](https://speedyk-005.github.io/chunklet-py/latest/migration/) for a smooth upgrade!
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
Hey! Welcome. Let's make some text chunking magic happen.
|
|
112
|
+
|
|
103
113
|
<p align="center">
|
|
104
114
|
<a href="https://speedyk-005.github.io/chunklet-py/latest" target="_blank" rel="noopener noreferrer">
|
|
105
115
|
-- documentation site --
|
|
@@ -168,7 +178,7 @@ Ready to get Chunklet-py running? Awesome! Let's get you set up quickly and pain
|
|
|
168
178
|
|
|
169
179
|
> [!NOTE]
|
|
170
180
|
> **chunklet-py (aka chunklet)** — The old `chunklet` package is no longer maintained. Use `chunklet-py` to get the latest version.
|
|
171
|
-
|
|
181
|
+
|
|
172
182
|
### The Quick & Easy Way
|
|
173
183
|
|
|
174
184
|
The simplest way to get started is with pip:
|
|
@@ -179,17 +189,28 @@ pip install chunklet-py
|
|
|
179
189
|
chunklet --version
|
|
180
190
|
```
|
|
181
191
|
|
|
192
|
+
> [!TIP]
|
|
193
|
+
> <b>Termux (Android)</b>
|
|
194
|
+
>
|
|
195
|
+
> No rust toolchain on Termux (especially python 3.13)? Install pydantic-core pre-built wheels first then retry installing chunklet-py:
|
|
196
|
+
>
|
|
197
|
+
> ```bash
|
|
198
|
+
> pip install typing-extensions
|
|
199
|
+
> pip install pydantic-core --index-url https://termux-user-repository.github.io/pypi/
|
|
200
|
+
> pip install "pydantic>=2.12.4,<2.13"
|
|
201
|
+
> ```
|
|
202
|
+
|
|
182
203
|
That's it! You're all set to start chunking.
|
|
183
204
|
|
|
184
205
|
### Extra Features (Optional)
|
|
185
206
|
|
|
186
207
|
Want to unlock more Chunklet-py superpowers? Add these optional dependencies based on what you need:
|
|
187
208
|
|
|
188
|
-
* **
|
|
209
|
+
* **Structured Documents:** For handling `.pdf`, `.docx`, `.epub`, and other document formats:
|
|
189
210
|
```bash
|
|
190
211
|
pip install "chunklet-py[structured-document]"
|
|
191
212
|
```
|
|
192
|
-
* **Code Chunking:** For
|
|
213
|
+
* **Code Chunking:** For Language-agnostic code chunking features:
|
|
193
214
|
```bash
|
|
194
215
|
pip install "chunklet-py[code]"
|
|
195
216
|
```
|
|
@@ -197,7 +218,7 @@ Want to unlock more Chunklet-py superpowers? Add these optional dependencies bas
|
|
|
197
218
|
```bash
|
|
198
219
|
pip install "chunklet-py[visualization]"
|
|
199
220
|
```
|
|
200
|
-
*
|
|
221
|
+
* **All Extras:** To install all optional dependencies:
|
|
201
222
|
```bash
|
|
202
223
|
pip install "chunklet-py[all]"
|
|
203
224
|
```
|
|
@@ -237,7 +258,8 @@ Go forth and code! (And remember, good developers write tests. We appreciate exc
|
|
|
237
258
|
|
|
238
259
|
## Quick Reference 🛠️
|
|
239
260
|
|
|
240
|
-
|
|
261
|
+
> [!NOTE]
|
|
262
|
+
> For the exhaustive details that I know you're probably avoiding, check the [official docs](https://speedyk-005.github.io/chunklet-py/latest/).
|
|
241
263
|
|
|
242
264
|
### The Constraint-Based Logic
|
|
243
265
|
|
|
@@ -245,9 +267,6 @@ Chunklet-py is basically a "choose your own adventure" for data. It's constraint
|
|
|
245
267
|
|
|
246
268
|
**The Golden Rule:** You must provide at least one constraint, or the chunker has no idea when to stop.
|
|
247
269
|
|
|
248
|
-
> [!NOTE]
|
|
249
|
-
> A quick overview — for the complete picture, check the [detailed docs](https://speedyk-005.github.io/chunklet-py/latest/).
|
|
250
|
-
|
|
251
270
|
### Core Imports
|
|
252
271
|
|
|
253
272
|
Pick your weapon based on whatever data mess you're currently cleaning up.
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
# 🧩 Chunklet-py
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="https://github.com/speedyk-005/chunklet-py/blob/main/logo_with_tagline.
|
|
4
|
+
<img src="https://github.com/speedyk-005/chunklet-py/blob/main/logo_with_tagline.svg?raw=true" alt="Chunklet-py Logo" width="300"/>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
>
|
|
10
|
-
> **Quick heads up!** Version 2 has some breaking changes. No worries though - check our [Migration Guide](https://speedyk-005.github.io/chunklet-py/latest/migration/) for a smooth upgrade!
|
|
11
|
-
|
|
12
|
-
Hey! Welcome. Let's make some text chunking magic happen.
|
|
7
|
+
<p align="center">
|
|
8
|
+
“One library to split them all: Sentence, Code, Docs”
|
|
9
|
+
</p>
|
|
13
10
|
|
|
14
|
-
[](https://www.python.org/downloads/)
|
|
15
12
|
[](https://pypi.org/project/chunklet-py)
|
|
16
13
|
[](https://pepy.tech/projects/chunklet-py)
|
|
17
14
|
[](https://coveralls.io/github/speedyk-005/chunklet-py?branch=main)
|
|
@@ -21,6 +18,13 @@ Hey! Welcome. Let's make some text chunking magic happen.
|
|
|
21
18
|
[](https://www.codefactor.io/repository/github/speedyk-005/chunklet-py)
|
|
22
19
|
[](https://deepwiki.com/speedyk-005/chunklet-py)
|
|
23
20
|
|
|
21
|
+
> [!WARNING]
|
|
22
|
+
> **Quick heads up!** Version 2 has some breaking changes. No worries though - check our [Migration Guide](https://speedyk-005.github.io/chunklet-py/latest/migration/) for a smooth upgrade!
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Hey! Welcome. Let's make some text chunking magic happen.
|
|
27
|
+
|
|
24
28
|
<p align="center">
|
|
25
29
|
<a href="https://speedyk-005.github.io/chunklet-py/latest" target="_blank" rel="noopener noreferrer">
|
|
26
30
|
-- documentation site --
|
|
@@ -89,7 +93,7 @@ Ready to get Chunklet-py running? Awesome! Let's get you set up quickly and pain
|
|
|
89
93
|
|
|
90
94
|
> [!NOTE]
|
|
91
95
|
> **chunklet-py (aka chunklet)** — The old `chunklet` package is no longer maintained. Use `chunklet-py` to get the latest version.
|
|
92
|
-
|
|
96
|
+
|
|
93
97
|
### The Quick & Easy Way
|
|
94
98
|
|
|
95
99
|
The simplest way to get started is with pip:
|
|
@@ -100,17 +104,28 @@ pip install chunklet-py
|
|
|
100
104
|
chunklet --version
|
|
101
105
|
```
|
|
102
106
|
|
|
107
|
+
> [!TIP]
|
|
108
|
+
> <b>Termux (Android)</b>
|
|
109
|
+
>
|
|
110
|
+
> No rust toolchain on Termux (especially python 3.13)? Install pydantic-core pre-built wheels first then retry installing chunklet-py:
|
|
111
|
+
>
|
|
112
|
+
> ```bash
|
|
113
|
+
> pip install typing-extensions
|
|
114
|
+
> pip install pydantic-core --index-url https://termux-user-repository.github.io/pypi/
|
|
115
|
+
> pip install "pydantic>=2.12.4,<2.13"
|
|
116
|
+
> ```
|
|
117
|
+
|
|
103
118
|
That's it! You're all set to start chunking.
|
|
104
119
|
|
|
105
120
|
### Extra Features (Optional)
|
|
106
121
|
|
|
107
122
|
Want to unlock more Chunklet-py superpowers? Add these optional dependencies based on what you need:
|
|
108
123
|
|
|
109
|
-
* **
|
|
124
|
+
* **Structured Documents:** For handling `.pdf`, `.docx`, `.epub`, and other document formats:
|
|
110
125
|
```bash
|
|
111
126
|
pip install "chunklet-py[structured-document]"
|
|
112
127
|
```
|
|
113
|
-
* **Code Chunking:** For
|
|
128
|
+
* **Code Chunking:** For Language-agnostic code chunking features:
|
|
114
129
|
```bash
|
|
115
130
|
pip install "chunklet-py[code]"
|
|
116
131
|
```
|
|
@@ -118,7 +133,7 @@ Want to unlock more Chunklet-py superpowers? Add these optional dependencies bas
|
|
|
118
133
|
```bash
|
|
119
134
|
pip install "chunklet-py[visualization]"
|
|
120
135
|
```
|
|
121
|
-
*
|
|
136
|
+
* **All Extras:** To install all optional dependencies:
|
|
122
137
|
```bash
|
|
123
138
|
pip install "chunklet-py[all]"
|
|
124
139
|
```
|
|
@@ -158,7 +173,8 @@ Go forth and code! (And remember, good developers write tests. We appreciate exc
|
|
|
158
173
|
|
|
159
174
|
## Quick Reference 🛠️
|
|
160
175
|
|
|
161
|
-
|
|
176
|
+
> [!NOTE]
|
|
177
|
+
> For the exhaustive details that I know you're probably avoiding, check the [official docs](https://speedyk-005.github.io/chunklet-py/latest/).
|
|
162
178
|
|
|
163
179
|
### The Constraint-Based Logic
|
|
164
180
|
|
|
@@ -166,9 +182,6 @@ Chunklet-py is basically a "choose your own adventure" for data. It's constraint
|
|
|
166
182
|
|
|
167
183
|
**The Golden Rule:** You must provide at least one constraint, or the chunker has no idea when to stop.
|
|
168
184
|
|
|
169
|
-
> [!NOTE]
|
|
170
|
-
> A quick overview — for the complete picture, check the [detailed docs](https://speedyk-005.github.io/chunklet-py/latest/).
|
|
171
|
-
|
|
172
185
|
### Core Imports
|
|
173
186
|
|
|
174
187
|
Pick your weapon based on whatever data mess you're currently cleaning up.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "chunklet-py"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.3.0"
|
|
4
4
|
description = "High-fidelity context-aware chunking and interactive visualization for RAG. Advanced segmentation for code and documents, because your LLM is only as smart as the fragments you feed it."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "speedyk_005", email = "speedy40115719@gmail.com" }
|
|
@@ -8,7 +8,7 @@ authors = [
|
|
|
8
8
|
|
|
9
9
|
license = "MIT"
|
|
10
10
|
readme = "README.md"
|
|
11
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
12
|
|
|
13
13
|
classifiers = [
|
|
14
14
|
"Development Status :: 5 - Production/Stable",
|
|
@@ -16,7 +16,6 @@ classifiers = [
|
|
|
16
16
|
"Intended Audience :: Science/Research",
|
|
17
17
|
"Intended Audience :: Information Technology",
|
|
18
18
|
"Operating System :: OS Independent",
|
|
19
|
-
"Programming Language :: Python :: 3.10",
|
|
20
19
|
"Programming Language :: Python :: 3.11",
|
|
21
20
|
"Programming Language :: Python :: 3.12",
|
|
22
21
|
"Programming Language :: Python :: 3.13",
|
|
@@ -35,22 +34,26 @@ keywords = [
|
|
|
35
34
|
]
|
|
36
35
|
|
|
37
36
|
dependencies = [
|
|
37
|
+
"loguru>=0.7.3,<1.0",
|
|
38
38
|
"pysbd>=0.3.4,<1.0",
|
|
39
39
|
"sentsplit>=1.0.8,<2.0",
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
"sentencex<=0.6.1",
|
|
41
|
+
# Rust binding (1.0+) for faster performance on supported platforms, legacy for Android.
|
|
42
|
+
"sentencex>=1.0.0,<2.0; platform_system != 'Android'",
|
|
43
|
+
"sentencex<=0.6.1; platform_system == 'Android'",
|
|
44
44
|
|
|
45
45
|
"indic-nlp-library>=0.92,<1.0",
|
|
46
46
|
"py3langid>=0.3.0,<1.0",
|
|
47
47
|
"mpire>=2.10.2,<3.0",
|
|
48
|
-
"
|
|
49
|
-
"more-itertools>=10.6.0,<
|
|
48
|
+
"dotdict3>=1.1.0,<2.0",
|
|
49
|
+
"more-itertools>=10.6.0,<12.0",
|
|
50
50
|
"regex>=2025.7.29",
|
|
51
|
-
"pydantic>=2.11.
|
|
51
|
+
"pydantic>=2.11.0,<3.0",
|
|
52
52
|
"typer>=0.19.0,<1.0",
|
|
53
53
|
"charset-normalizer>=3.4.2,<4.0",
|
|
54
|
+
|
|
55
|
+
# sentsplit depends on deprecated pkg_resources removed in setuptools 81.0.0
|
|
56
|
+
"setuptools<81",
|
|
54
57
|
]
|
|
55
58
|
|
|
56
59
|
[project.optional-dependencies]
|
|
@@ -83,17 +86,21 @@ visualization = [
|
|
|
83
86
|
"uvicorn>=0.35.0,<1.0",
|
|
84
87
|
"fastapi>=0.116.0,<1.0",
|
|
85
88
|
"python-multipart>=0.0.20,<1.0",
|
|
89
|
+
"msgpack>=1.1.0,<2.0",
|
|
86
90
|
|
|
87
91
|
# Major changes happens often
|
|
88
92
|
"aiofiles==25.1.0",
|
|
89
93
|
]
|
|
90
94
|
|
|
95
|
+
viz = ["chunklet-py[visualization]"]
|
|
96
|
+
|
|
91
97
|
all = ["chunklet-py[structured-document,code,visualization]"]
|
|
92
98
|
|
|
93
99
|
dev = [
|
|
94
100
|
"pytest>=8.3.5",
|
|
95
101
|
"pytest-cov>=6.2.1",
|
|
96
102
|
"pytest-mock>=3.14.1",
|
|
103
|
+
"pytest-timeout>=2.3.1",
|
|
97
104
|
"ruff>=0.14.14",
|
|
98
105
|
]
|
|
99
106
|
|
|
@@ -119,7 +126,7 @@ chunklet = "chunklet.cli:app"
|
|
|
119
126
|
|
|
120
127
|
[build-system]
|
|
121
128
|
requires = [
|
|
122
|
-
"setuptools>=64",
|
|
129
|
+
"setuptools>=64",
|
|
123
130
|
"wheel", # Essential for building dependencies that use legacy setup.py (like odfpy)
|
|
124
131
|
]
|
|
125
132
|
build-backend = "setuptools.build_meta"
|
|
@@ -139,7 +146,7 @@ packages = [
|
|
|
139
146
|
include-package-data = true
|
|
140
147
|
|
|
141
148
|
[tool.setuptools.package-data]
|
|
142
|
-
chunklet = ["visualizer/static
|
|
149
|
+
chunklet = ["visualizer/static/**/*"]
|
|
143
150
|
|
|
144
151
|
[tool.pytest.ini_options]
|
|
145
152
|
minversion = "7.4"
|
|
@@ -150,6 +157,7 @@ filterwarnings = [
|
|
|
150
157
|
|
|
151
158
|
# disable coverage report to prevent racing with multiprocessing
|
|
152
159
|
# addopts = "--cov=chunklet --cov-report=term-missing:skip-covered --durations=10"
|
|
160
|
+
addopts = "--timeout=60"
|
|
153
161
|
|
|
154
162
|
testpaths = ["tests"]
|
|
155
163
|
python_files = "test_*.py"
|
|
@@ -186,6 +194,9 @@ ignore = ["E501", "E203"]
|
|
|
186
194
|
# Ignore warnings about File(...)
|
|
187
195
|
"src/chunklet/visualizer/visualizer.py" = ["B008"]
|
|
188
196
|
|
|
197
|
+
# Ignore E402 - warnings.filterwarnings() must be called before imports to suppress pkg_resources
|
|
198
|
+
"src/chunklet/sentence_splitter/sentence_splitter.py" = ["E402"]
|
|
199
|
+
|
|
189
200
|
[tool.ruff.format]
|
|
190
201
|
# Replaces Black exclude logic
|
|
191
202
|
exclude = [
|
|
@@ -60,9 +60,11 @@ __all__ = [
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# Map the public names to their sub-module locations
|
|
63
|
+
_PLAIN_TEXT_CHUNKER_MODULE = "chunklet.plain_text_chunker"
|
|
64
|
+
|
|
63
65
|
_LOOKUP = {
|
|
64
66
|
"SentenceSplitter": "chunklet.sentence_splitter",
|
|
65
|
-
"PlainTextChunker":
|
|
67
|
+
"PlainTextChunker": _PLAIN_TEXT_CHUNKER_MODULE,
|
|
66
68
|
"DocumentChunker": "chunklet.document_chunker",
|
|
67
69
|
"CodeChunker": "chunklet.code_chunker",
|
|
68
70
|
"Visualizer": "chunklet.visualizer",
|
|
@@ -77,7 +79,7 @@ class _PlainTextChunkerModuleProxy(types.ModuleType):
|
|
|
77
79
|
"""
|
|
78
80
|
|
|
79
81
|
def __init__(self):
|
|
80
|
-
super().__init__(
|
|
82
|
+
super().__init__(_PLAIN_TEXT_CHUNKER_MODULE)
|
|
81
83
|
self._PlainTextChunker: typing.Any = None
|
|
82
84
|
|
|
83
85
|
def _get_deprecated_class(self):
|
|
@@ -99,7 +101,7 @@ class _PlainTextChunkerModuleProxy(types.ModuleType):
|
|
|
99
101
|
|
|
100
102
|
|
|
101
103
|
# Register proxy in sys.modules for backward compatibility
|
|
102
|
-
sys.modules[
|
|
104
|
+
sys.modules[_PLAIN_TEXT_CHUNKER_MODULE] = _PlainTextChunkerModuleProxy()
|
|
103
105
|
|
|
104
106
|
|
|
105
107
|
def __getattr__(name: str) -> typing.Any:
|
|
@@ -7,7 +7,7 @@ Defines the interface for chunkers.
|
|
|
7
7
|
from abc import ABC, abstractmethod
|
|
8
8
|
from collections.abc import Generator
|
|
9
9
|
|
|
10
|
-
from
|
|
10
|
+
from dotdict3 import DotDict
|
|
11
11
|
from loguru import logger
|
|
12
12
|
|
|
13
13
|
|
|
@@ -22,41 +22,41 @@ class BaseChunker(ABC):
|
|
|
22
22
|
self.verbose = verbose
|
|
23
23
|
|
|
24
24
|
@abstractmethod
|
|
25
|
-
def chunk_text(self, *args, **kwargs) -> list[
|
|
25
|
+
def chunk_text(self, *args, **kwargs) -> list[DotDict]:
|
|
26
26
|
"""
|
|
27
27
|
Extract chunks from text.
|
|
28
28
|
|
|
29
29
|
Returns:
|
|
30
|
-
|
|
30
|
+
List of chunks with content and metadata.
|
|
31
31
|
"""
|
|
32
32
|
pass
|
|
33
33
|
|
|
34
34
|
@abstractmethod
|
|
35
|
-
def chunk_texts(self, *args, **kwargs) -> list[list[
|
|
35
|
+
def chunk_texts(self, *args, **kwargs) -> list[list[DotDict]]:
|
|
36
36
|
"""
|
|
37
37
|
Process multiple texts.
|
|
38
38
|
|
|
39
39
|
Returns:
|
|
40
|
-
|
|
40
|
+
List of chunks for each input text.
|
|
41
41
|
"""
|
|
42
42
|
pass
|
|
43
43
|
|
|
44
44
|
@abstractmethod
|
|
45
|
-
def chunk_file(self, *args, **kwargs) -> list[
|
|
45
|
+
def chunk_file(self, *args, **kwargs) -> list[DotDict]:
|
|
46
46
|
"""
|
|
47
47
|
Read and chunk a file.
|
|
48
48
|
|
|
49
49
|
Returns:
|
|
50
|
-
|
|
50
|
+
List of chunks with content and metadata.
|
|
51
51
|
"""
|
|
52
52
|
pass
|
|
53
53
|
|
|
54
54
|
@abstractmethod
|
|
55
|
-
def chunk_files(self, *args, **kwargs) -> Generator[
|
|
55
|
+
def chunk_files(self, *args, **kwargs) -> Generator[DotDict, None, None]:
|
|
56
56
|
"""
|
|
57
57
|
Process multiple files.
|
|
58
58
|
|
|
59
59
|
Yields:
|
|
60
|
-
|
|
60
|
+
`DotDict` object, representing a chunk with its content and metadata.
|
|
61
61
|
"""
|
|
62
62
|
pass
|