{"library":"sentence-stream","title":"Sentence Stream","description":"Sentence Stream is a small, pure Python library for splitting text into sentences. It is designed to work efficiently with text streams, such as large files or network streams, by processing text incrementally without loading the entire content into memory. The current version is 1.3.0, and it maintains an active release cadence for improvements and bug fixes.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install sentence-stream"],"cli":null},"imports":["from sentence_stream import SentenceStream"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from sentence_stream import SentenceStream\n\n# Example with a simple string\ntext_input = \"Hello world. This is a test. Another sentence.\\nNew paragraph. One more?\"\nstream = SentenceStream(text_input)\n\nprint(\"--- Processing string input ---\")\nfor sentence in stream:\n    print(f\"'{sentence}'\")\n\n# Example with a file-like object (simulate stream)\nimport io\nlong_text = \"This is the first sentence. And here is the second one. \" \\\n            \"The third sentence continues here. Finally, a fourth.\" \\\n            \"This could be a very large file.\" * 10\n\nfile_stream = io.StringIO(long_text)\nstream_from_file = SentenceStream(file_stream)\n\nprint(\"\\n--- Processing file-like object ---\")\nsentences_count = 0\nfor sentence in stream_from_file:\n    # print(f\"'{sentence}'\") # Uncomment to see all sentences\n    sentences_count += 1\nprint(f\"Processed {sentences_count} sentences from stream.\")\n","lang":"python","description":"Initialize `SentenceStream` with a string or an iterable (like a file-like object). The instance is itself an iterable, yielding sentences one by one.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}