Slovorez
English · Русский
Slovorez does morpheme segmentation of Russian words. The model has 215K parameters and runs on CPU through ONNX Runtime. The tokenizer is written in C++.
The model was trained on lemmas. Support for inflected forms is planned for future versions, see "Limitations".
Example
from slovorez import Slovorez
model = Slovorez.from_pretrained() # bundled model slovorez-flash
model.predict("перевыполнить, улыбаться")
[{'word': 'перевыполнить',
'morphemes': [['пере', 'PREF', 0.99], ['вы', 'PREF', 0.96], ['полн', 'ROOT', 0.99],
['и', 'SUFF', 1.0], ['ть', 'SUFF', 1.0]],
'confidence': 0.95,
'model': 'slovorez-flash'},
{'word': 'улыбаться',
'morphemes': [['улыб', 'ROOT', 0.86], ['а', 'SUFF', 0.99], ['ть', 'SUFF', 1.0],
['ся', 'POSTFIX', 1.0]],
'confidence': 0.77,
'model': 'slovorez-flash'}]
morphemes: a list of[text, type, score].confidence: confidence in the parse of the whole word, from 0 to 1.- Words are lowercased and kept in text order, duplicates included. Only Cyrillic is parsed.
Morpheme types:
| type | meaning |
|---|---|
| PREF | prefix |
| ROOT | root |
| SUFF | suffix |
| END | ending (inflection) |
| POSTFIX | postfix |
| LINK | linking vowel (interfix) |
| HYPH | hyphen |
The Viterbi decoder only allows valid transitions between morphemes.
Large files
model.process_file("text.txt") # single thread
model.process_file("text.txt", threaded_mode=True) # inference in several threads
Results are appended to a jsonl file, one record per line, in the same format as predict. By default the file is ~/.cache/slovorez/predictions/<model>/<version>/predictions.jsonl. SLOVOREZ_HOME changes the folder; from_pretrained(predictions_path=...) sets the file.
Words already in the file from earlier runs are skipped, so an interrupted run can be started again. Words are deduplicated before segmentation.
Words from the model's bundled dictionary (base_dict.json, ≈96K lemmas) are not segmented by process_file and are not written to the jsonl: the dictionary already has their parses.
Installation
pip install slovorez
Ready-made wheels cover Python 3.10–3.13 on Linux, Windows and macOS (Apple Silicon). On other platforms and Python versions pip builds the tokenizer from source, which needs a C++ compiler (MSVC Build Tools on Windows). Python 3.10+.
Quality
slovorez-flash, Viterbi decoder. Metrics from measure_quality of Morozov et al. (2025), gold standard: base_dict 0.2.0.
| Test | Boundary F1 | Root F1 | Accuracy | Word Acc |
|---|---|---|---|---|
| Known roots (5,000 held-out words) | 95.69 | 87.15 | 92.53 | 75.50 |
| New roots (10 folds by root group) | 94.31 ± 0.43 | 81.95 ± 1.45 | 89.61 ± 0.82 | 69.42 ± 1.86 |
Boundary F1: over all morpheme boundaries. Root F1: over root boundaries. Accuracy: per character. Word Acc: share of words parsed fully correctly. In the second row the test roots were never seen in training; values are mean ± standard deviation over folds.
0.1.0 used a different model and a different test set.
Speed
1M sentences of Russian news (Leipzig rus_news_2023_1M, 13.8M tokens), AMD Ryzen 7 5700X, Windows 10. process_file columns are tokens per second. 0.1.0 runs with use_viterbi=True, so both versions use the same decoder.
process_file, 1 thread |
process_file, 8 workers |
predict, ms |
load, s | memory, MB | |
|---|---|---|---|---|---|
| slovorez 0.1.0 | 152K | 94K | 2.60 | 0.51 | 283 |
| slovorez 0.2.0 | 210K | 396K | 1.75 | 0.42 | 244 |
predict: median time for one sentence. Load: from_pretrained. Memory: peak process memory.
Throughput depends on corpus size, because each unique word goes to the model only once. The upper limit is the tokenizer, about 630K tokens/s. Full tables (100K and 1M sentences, 2/4/8 workers, model-only speed, p95), the environment and the method are in bench/README.md.
Confidence
confidence estimates the chance that the whole word is parsed correctly. On the test words from the Quality section, keeping only words above a threshold gives:
| Threshold | Words kept | word accuracy, random/root |
|---|---|---|
| none | 100% | 75.5% / 69.4% |
| 0.7 | 56% | 91.1% / 84.1% |
| 0.8 | 43% | 94.5% / 87.9% |
| 0.9 | 26% | 97.6% / 92.8% |
On new roots confidence is slightly too high above 0.7. This is measured on lemmas; on word forms from real text confidence is lower.
Limitations
Tested with the suite in tests/ and on text corpora on one machine (Windows). Not tested under production load or on low-end devices.
- The model was trained on lemmas. Inflected forms come out worse, e.g.
выделяются→вы|дел|я|ютс|я. - Words longer than 64 characters are skipped without a warning.
- Tokenizer (C++): a chain of 9 or more hyphenated parts, or a word longer than 128 characters, loses all the text after it.
- A hyphenated word at the very end of a file, with no newline after it, can be lost.
predictworks around this. - If
process_fileraises, create the object again withfrom_pretrained. Words written before the error are kept. - The order of records in the jsonl depends on
PYTHONHASHSEED.
How it works
For each letter the model predicts a BIES tag (beginning, inside, end of a morpheme, or a single-letter morpheme) together with the morpheme type. Network: letter embeddings, three Conv1D layers (kernel 5), a head of 1×1 convolutions. The C++ tokenizer is bound through pybind11; inference runs through ONNX Runtime.
License
MIT. Copyright (c) 2026 heysonanderson, pubari. See LICENSE.
Citation
See CITATION.cff.
@software{slovorez,
author = {heysonanderson and pubari},
title = {Slovorez: neural morpheme segmentation for Russian},
year = {2026},
version = {0.2.0},
url = {https://github.com/heysonanderson/slovorez},
license = {MIT}
}
Metadata
Release files for slovorez 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| slovorez-0.2.0.tar.gz | 2.6 MB | With provenance | Details for slovorez-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 35.3 MB
Release files / slovorez-0.2.0.tar.gz
| Download URL | slovorez-0.2.0.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1244d96d58e631afae2e95ce114409feab81df99ea727a349b1df0c16299020c
|
|
BLAKE2b-256 checksum How to use checksums |
8458f9b4c2d3d1320d78f1264372720b60c33f63d6504358a1bd2521561f2f35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp313-cp313-win_amd64.whl
| Download URL | slovorez-0.2.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8f5aecfa42d0730e38e5a6ba68806e0289fd6cc4eec54ab81995993e647e5805
|
|
BLAKE2b-256 checksum How to use checksums |
307c4d8f15c4308391ce9299afd64c38ca2f86150d11158dc2cc94a64cb4d834
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | slovorez-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
1508f082e6597b4cf1d9852e999ec25d19a521b1cbc135fc85f5cebee40b389d
|
|
BLAKE2b-256 checksum How to use checksums |
763fb38812b71ec5bdae688aa34a4c351d41aee13038d39009e13f7f9c80153e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | slovorez-0.2.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
37396a32f24e3c9e5d5eea0a336fa32b91e45b397d538c7d763236d3718cddf2
|
|
BLAKE2b-256 checksum How to use checksums |
8d252f05f63d6349e54666c8c6fcfbd571b712fe4feaf13b4c23e0f8faeabf83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp312-cp312-win_amd64.whl
| Download URL | slovorez-0.2.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1d873040210c048e77a7cf68d3b2c794a82d122d22d52c3ad49f0d4c8fa33afb
|
|
BLAKE2b-256 checksum How to use checksums |
411192f9d6604bec92fc3a64cf47d33fd35a67e80d619a57a0250413b203b664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | slovorez-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a134bf1ee0bbfcaa121afdc889de90d3f127efb3da0f44a05e7801521a162857
|
|
BLAKE2b-256 checksum How to use checksums |
f0c655d40cfd8c085646623b884740ce572e7d6e8ca14110dd65dbeea8875f24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | slovorez-0.2.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f312165688e2791a687be5419b3124f5b4301e437dfae58785b2f135f137db18
|
|
BLAKE2b-256 checksum How to use checksums |
675d8bfc56813d89871209a2a995e3c2830c3933ef02e23b3274e154a47695e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp311-cp311-win_amd64.whl
| Download URL | slovorez-0.2.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0f52fee57a1ff84d6d971ccbe5eb05f237422950ef5ccc8768f359262f929939
|
|
BLAKE2b-256 checksum How to use checksums |
ae3ba2d7e480036086833fdb27919726d1af6200b92ca9f10c9c92ee9d37047c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | slovorez-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ed354a202ce906be3d8eb201a2a2c2daf93519be279281ab5b8f8c95154d509e
|
|
BLAKE2b-256 checksum How to use checksums |
4deb2136b5452a04c52b468a2d5d135f685c97e0fee3e5ac7f6fc9e3cd94c3a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | slovorez-0.2.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1bb0fe17ce6e83d02fb65cffb32e10328a16e40e78e34404c02bc95904f43a2c
|
|
BLAKE2b-256 checksum How to use checksums |
21545d226eb8c7d401b3fb208269e0cc77241ee6890382ee5dfe2676c77efeee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp310-cp310-win_amd64.whl
| Download URL | slovorez-0.2.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f5d12a5e1843f3955f2faec8651501e5a8867b80c5f4a4dfed841ecd1e093ea3
|
|
BLAKE2b-256 checksum How to use checksums |
5a5bf0e59eb219a8389252bb4858242b6d40cf4cbf88db35bc8ae86328c49357
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | slovorez-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
448ccc5a49be24179d401ae9df3b2a1afddb0b8331da01e63cfd225137c4102f
|
|
BLAKE2b-256 checksum How to use checksums |
3eca9edf70b17fec7a3377516d2ed81723da5b905b2c7cbe15a7411ee1f9ba2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / slovorez-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | slovorez-0.2.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8378239bef2758268abe5b417295ed55caf8e7017275b36f59f0832067c74796
|
|
BLAKE2b-256 checksum How to use checksums |
b6ccddb270cd2341847ba882bd6f48c115ee9d637b6269a5883c2291705d1a24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logSecurity for slovorez 0.2.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
All 13 files in this release have been uploaded with provenance metadata.
Attestation for slovorez-0.2.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 Nov 18, 2026.
Transparency logA 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.