ogonki
Restore Polish diacritics in text typed without them. A tiny character-level model that runs offline with numpy only.
pip install ogonki
>>> from ogonki import restore
>>> restore("Wczoraj bylem w Lodzi")
'Wczoraj byłem w Łodzi'
>>> restore("Zolw zjadl salate")
'Żółw zjadł sałatę'
>>> df["title"] = df["title"].map(restore) # pandas
ogonki notes.txt > fixed.txt
echo "Sprzedam rower gorski, stan bardzo dobry, odbior osobisty w Gdansku" | ogonki
- Tiny and offline: a 0.8 MB model, with numpy as the only dependency. No GPU, API key or download on first use.
- Fast: about 125,000 characters per second on a laptop CPU.
- Safe: only
a c e l n o s zcan change, and the output always has the same length as the input. Words that already have Polish letters, URLs and e-mail addresses are left untouched.
Benchmark
Word accuracy on 300,000 characters of held-out Polish web text (FineWeb-2), counting only words that could take a diacritic. Reproduce with python train.py.
| method | word accuracy |
|---|---|
| no change | 63.34% |
| dictionary (most frequent spelling seen in training) | 96.80% |
| ogonki | 98.46% |
ogonki makes about half as many mistakes as a dictionary lookup (1.5% of words instead of 3.2%).
Limitations
- Rare words can be missed, for example in the pangram Zażółć gęślą jaźń.
- Words whose spelling depends on meaning usually get the more common form: sad (orchard) vs sąd (court), czuje (he feels) vs czuję (I feel), laska (cane) vs łaska (grace).
- The model was trained and tested on web text only. Accuracy on OCR output, chat messages or old documents hasn't been measured yet.
How it works
For every a c e l n o s z, a small character-level CNN (8 dilated convolution layers that see 38 characters on each side) picks one of three classes: leave it, add the usual diacritic (a→ą, l→ł, z→ż…), or z→ź. The training data is free: take Polish text, strip its diacritics, and learn to put them back.
ogonki/__init__.py restore(), strip(), CLI (~75 lines, numpy only)
ogonki/weights.npz trained model (produced by train.py)
train.py data -> train -> export -> benchmark
Train it yourself
Training takes under an hour on a free Google Colab T4 GPU, and much longer on a CPU.
pip install -e ".[train]"
python train.py
Data
Trained on the Polish part of FineWeb-2 by Hugging Face, released under the ODC-By 1.0 license.
License
MIT
Metadata
Release files for ogonki 0.1.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 | |
|---|---|---|---|
| ogonki-0.1.0.tar.gz | 1.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ogonki-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.8 MB
Release files / ogonki-0.1.0.tar.gz
| Download URL | ogonki-0.1.0.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dd923bbee373b8a26b944dd03e29b63f450ea4daacfb4196ea0937a7b6aeb15
|
|
BLAKE2b-256 checksum How to use checksums |
da551a7004db40f665ad541d268454482f743fb6dd62291cefd2fc9734cbf761
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 2, 2026.
Transparency logRelease files / ogonki-0.1.0-py3-none-any.whl
| Download URL | ogonki-0.1.0-py3-none-any.whl |
|---|---|
| Size | 770.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef09521020a075e0c4b4845f212e6acafe8671eae6ad531c4eefbcef57a58990
|
|
BLAKE2b-256 checksum How to use checksums |
cdd423a448ad9a04078c03f2c75e97cbfc3b89f224e690e2ce8c1fd4c04654e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 2, 2026.
Transparency log