Skip to main content

PySET - Python Sentence Extraction Toolkit

PyPI Version Python Versions License

Python Sentence Extraction Toolkit is a high-performance, zero-dependency, sentence boundary detection library designed to break down any provided text into indivdual sentences to be used as required. It was intially buildt to fill the need for a efficient modern system to break down sentences in text for form co-hearent chunks when indexing into a vector database but it has a wide range of applicaitons.

Built for Python 3.14

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 pysentence-extraction-toolkit

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.

chart chart

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.

Metadata

Release files for pysentence-extraction-toolkit 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysentence-extraction-toolkit 2.0.0
File Size Uploaded Provenance Actions
pysentence_extraction_toolkit-2.0.0.tar.gz 1.9 MB With provenance Details for pysentence_extraction_toolkit-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysentence-extraction-toolkit 2.0.0
File Interpreter ABI Platform Actions
pysentence_extraction_toolkit-2.0.0-py3-none-any.whl Python 3 none any Details for pysentence_extraction_toolkit-2.0.0-py3-none-any.whl

Total release size: 2.7 MB

Release files / pysentence_extraction_toolkit-2.0.0.tar.gz

Download URL pysentence_extraction_toolkit-2.0.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
ec66c77ae080b68cb5c413d65a03f7d7058ebab3d6390cf81dbb3ec91a9ae1a1
BLAKE2b-256 checksum
How to use checksums
3db2ef3cc3b0fc32506b06ca8a718cf21b46ecd16322b62c9cec6fe0438c8aff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / pysentence_extraction_toolkit-2.0.0-py3-none-any.whl

Download URL pysentence_extraction_toolkit-2.0.0-py3-none-any.whl
Size 841.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8d64a20095be28574a8c46c8b41175e48b684a65251d7d11ef2b8a9a8b6040b
BLAKE2b-256 checksum
How to use checksums
823b518a4bbe33781402dad4e8065f914f481becd6d3702a0e2c38e41a64a9a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Security for pysentence-extraction-toolkit 2.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pysentence_extraction_toolkit-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page