A fundamental sentence splitter based on spacy.
Project description
Fun Sentence Splitter
A fundamental sentence splitter based on spacy.
Usage
from fun_sentence_splitter import init
splitter = init(spacy_model="de_core_news_sm")
for sentence in splitter("Das ist ein Satz. Und hier noch einer!"):
print(sentence.text, sentence.span)
init(...) returns a splitter function. Each Sentence exposes .text and .span (a (start, end) index pair into the original text).
Split on line breaks first (e.g. for structured documents) and only run spaCy on longer lines:
splitter = init(
spacy_model="de_core_news_sm",
always_split_on_line_breaks=True,
max_len_before_split=100,
)
Download the language model once:
uv run python -m spacy download de_core_news_sm
Requirements
uv.
Local Dev Setup
Install dependencies and download the Spacy language model used in the tests:
uv sync
uv run python -m spacy download de_core_news_sm
Run static checks and tests:
uv run ruff check .
uv run mypy .
uv run pytest --cov=fun_sentence_splitter
Run Evaluation
./evaluate.sh path/to/splits_dir
path/to/splits_dir: directory containing pairs of *.split and *.txt files. .split files contain the expected
sentences, each on a separate line. .txt files contain the original text to split.
The evaluation script will automatically update the spacy dependency and download the required language models.
Project details
Release history Release notifications | RSS feed
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 fun_sentence_splitter-0.7.3814.20260724.tar.gz.
File metadata
- Download URL: fun_sentence_splitter-0.7.3814.20260724.tar.gz
- Upload date:
- Size: 59.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b2fda50af67fb9e322a33ef2355642930971211d842da523dd9963c516f4e72
|
|
| MD5 |
5fa24aa6d9a85e9549ce68a43160ee48
|
|
| BLAKE2b-256 |
0e6110e54b32f90b9e9a2b023dd9096a48f9b54efa9a08eed49f1c3993aedd81
|
File details
Details for the file fun_sentence_splitter-0.7.3814.20260724-py3-none-any.whl.
File metadata
- Download URL: fun_sentence_splitter-0.7.3814.20260724-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b54dcf4e4fbf477eae584c5cf0994f643563e1fd521f6c4310a37c538582722
|
|
| MD5 |
f4d5e71984679ef6272eb2b258bbdf37
|
|
| BLAKE2b-256 |
a99297eb76a9a085d1bb14877021bb9df85a636ad029ac05a8b6db6429dd6be6
|