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 | Provenance | Actions |
|---|---|---|---|---|
| textsplitter-1.0.3.tar.gz | 2.8 kB | Without provenance | Details for textsplitter-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| textsplitter-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for textsplitter-1.0.3-py3-none-any.whl |
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
|
Security for textsplitter 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.