sentence-stream 1.3.0


pip install sentence-stream

  Latest version

Released: Jan 08, 2026

Project Links

Meta
Author: The Home Assistant Authors
Requires Python: >=3.9.0

Classifiers

Development Status
  • 3 - Alpha

Intended Audience
  • Developers

Topic
  • Text Processing :: Linguistic

License
  • OSI Approved :: Apache Software License

Programming Language
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Sentence Stream

A small sentence splitter for text streams.

Install

pip install sentence-stream

Example

from sentence_stream import stream_to_sentences

text_chunks = [
    "Text chunks that a",
    "re not on",
    " word or se",
    "ntence boundarie",
    "s. But, they w",
    "ill sti",
    "ll get sp",
    "lit right",
    "!!! Goo",
    "d",
]

assert list(stream_to_sentences(text_chunks)) == [
    "Text chunks that are not on word or sentence boundaries.",
    "But, they will still get split right!!!",
    "Good",
]

For async streams, use async_stream_to_sentences.

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
regex (>=2024.11.6)