PySET - Python Sentence Extraction Toolkit. High-performance, zero-dependency sentence boundary detection.
Project description
PySET - Python Sentence Extraction Toolkit
A high-performance, zero-dependency sentence boundary detection library.
Features
- 85 intelligent rules for accurate sentence splitting
- 52 languages supported
- Zero dependencies (pure Python standard library)
- 2-3x faster than comparable libraries
- More accurate on complex legal documents
- Extensible design for custom rules
Installation
pip install pyset
Quick Start
from pyset import TokenBoundaryDetector
detector = TokenBoundaryDetector()
# Simple usage
text = "Hello world. How are you? I'm doing great!"
sentences = detector.split(text)
print(sentences)
# ['Hello world.', 'How are you?', "I'm doing great!"]
Performance
Based on internal benchmarks vs PySBD:
| Text Size | Words | PySET | PySBD | Speedup |
|---|---|---|---|---|
| Sentences | ~5 | 0.05ms | 0.10ms | 2.0x |
| Paragraph | ~104 | 0.60ms | 1.37ms | 2.3x |
| Article | ~484 | 2.41ms | 5.25ms | 2.2x |
| Document | ~1400 | 5.68ms | 21.95ms | 3.9x |
PySET processes 158,000+ words/second vs 63,000 for PySBD.
Why PySET?
- Zero dependencies - No external packages required
- 85 rules handling edge cases like abbreviations, URLs, emails, decimals, quotes
- Accurate - Priority-based rule evaluation for correct decisions
- Fast - Pre-compiled patterns and optimized algorithms
- Extensible - Easy to add custom rules
- Well tested - 100% accuracy on 52 languages
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
language |
str | 'en' |
Language code |
min_sentence_length |
int | 1 |
Minimum sentence length |
aggressive_abbreviations |
bool | False |
Stricter abbreviation handling |
merge_short_sentences |
bool | False |
Merge short sentences |
include_rules |
List[int] | None |
Use specific rules |
exclude_rules |
List[int] | None |
Exclude specific rules |
debug |
bool | False |
Enable debug logging |
Use Cases
- Document chunking for LLMs and RAG systems
- Text preprocessing for NLP pipelines
- Legal document analysis
- News article segmentation
- Academic paper processing
- Content extraction and cleaning
Documentation
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run with coverage
pytest tests/ --cov=pyset
License
MIT License - See LICENSE file for details.
PySET - Python Sentence Extraction Toolkit Accurate. Fast. Zero Dependencies.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 pysentence_extraction_toolkit-1.0.0.tar.gz.
File metadata
- Download URL: pysentence_extraction_toolkit-1.0.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00e7a811fb4c5f73c6a8f756fe59aa90ccdd9676f20206d013c8b6178c6ec883
|
|
| MD5 |
58b71376db509fc3d19a8db705d55cd4
|
|
| BLAKE2b-256 |
98a7f59039d63938454dd96e98b14178373fcc1310fa7e6c2efea99c3313836d
|
Provenance
The following attestation bundles were made for pysentence_extraction_toolkit-1.0.0.tar.gz:
Publisher:
build.yml on CosmonautCode/PySentence-Extraction-Toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysentence_extraction_toolkit-1.0.0.tar.gz -
Subject digest:
00e7a811fb4c5f73c6a8f756fe59aa90ccdd9676f20206d013c8b6178c6ec883 - Sigstore transparency entry: 1494033196
- Sigstore integration time:
-
Permalink:
CosmonautCode/PySentence-Extraction-Toolkit@7020e1aada5c9b4a0a5a29c2a212fc95d732078b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CosmonautCode
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@7020e1aada5c9b4a0a5a29c2a212fc95d732078b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pysentence_extraction_toolkit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pysentence_extraction_toolkit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73b8d36481409390a9079961d5ee2e129511c2121afb14411f76a08f11d7d735
|
|
| MD5 |
7ee0a1d07aee284bd652513994cdfac5
|
|
| BLAKE2b-256 |
a91748f1979be47e8129506b68b7f0d38b3f21534b6228c6448c1a9a2328b11f
|
Provenance
The following attestation bundles were made for pysentence_extraction_toolkit-1.0.0-py3-none-any.whl:
Publisher:
build.yml on CosmonautCode/PySentence-Extraction-Toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysentence_extraction_toolkit-1.0.0-py3-none-any.whl -
Subject digest:
73b8d36481409390a9079961d5ee2e129511c2121afb14411f76a08f11d7d735 - Sigstore transparency entry: 1494033244
- Sigstore integration time:
-
Permalink:
CosmonautCode/PySentence-Extraction-Toolkit@7020e1aada5c9b4a0a5a29c2a212fc95d732078b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CosmonautCode
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@7020e1aada5c9b4a0a5a29c2a212fc95d732078b -
Trigger Event:
push
-
Statement type: