Text Splitter
A Python library to split large text into smaller chunks based on the maximum token size and other criteria.
Features
- Split text into smaller chunks based on maximum token size
- End chunks at sentence boundaries
- Preserve formatting
- Remove URLs
- Replace entities
- Remove stopwords
Installation
To install the library, run the following command:
pip install textsplitter
Usage
Here's a simple example of how to use the TextSplitter:
from textsplitter import TextSplitter
sample_text = "Your sample text goes here..."
text_splitter = TextSplitter(max_token_size=20, end_sentence=True, preserve_formatting=True,
remove_urls=True, replace_entities=True, remove_stopwords=True, language='english')
chunks = text_splitter.split_text(sample_text)
for i, chunk in enumerate(chunks):
print(f"Chunk {i + 1}:\n{chunk}")
Metadata
Release files for textsplitter 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| textsplitter-1.0.3.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| textsplitter-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.9 kB
Release files / textsplitter-1.0.3.tar.gz
| Download URL | textsplitter-1.0.3.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35a2c47d22a67a85674f82e9fcbc884926523cdaa29a8d3817637d31b6e47851
|
|
BLAKE2b-256 checksum How to use checksums |
848c682f1a35449b2268e3e4a5d23c0ec415fbab6d2b137281236475739b3ead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / textsplitter-1.0.3-py3-none-any.whl
| Download URL | textsplitter-1.0.3-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efeca488d2c74112490dc6126f3e8f6cc4f977cd8e92fda5282bb801d1ac079c
|
|
BLAKE2b-256 checksum How to use checksums |
807534f8d669e2c06bfdb36d95ae7295ba61ae927cd2f5916dcd740c362566a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|