Polish Whisper Normalizer
Polish port of OpenAI Whisper normalizers — keeps
ąćęłńóśźż, normalizes numbers/time/currency/dates with Morfeusz2 declensions.
English
Features
| Area | Example | Normalized |
|---|---|---|
| Diacritics | Żółć! |
żółć (kept) / zolc with remove_diacritics=True |
| Cardinal / ordinal | sto dwadzieścia trzy, dwudziestu pięciu, pierwszego → 1. |
123, 25, 1. |
| Time | piąta trzydzieści, wpół do ósmej, o piątej, piąta rano, od piątej do szóstej |
5:30, 7:30, o 5:00, 5:00 rano, od 5:00 do 6:00 |
Time with minut |
dziesięć minut po piątej, za dwadzieścia minut ósma |
5:10, 7:40 |
| Fractions | jedna trzecia, trzy czwarte |
1/3, 3/4 (keeps /, idempotent) |
| Half | pół litra, półtora, dwa i pół |
0.5 litra, 1.5, 2.5 |
| Currency | pięć złotych, €10, pięć złotówek |
5 zł, 10 €, 5 zł |
| Percent | pięć procentów |
5% |
| Ordinal multipliers | tysiąc dziewięćsetny |
1900. |
| Dates ✨ | 5 maja → 05.05 · piątego maja → 05.05 · piątego maja 2026 → 05.05.2026 · piątego maja roku dwa tysiące dwudziestego szóstego → 05.05.2026 |
DD.MM / DD.MM.YYYY zero-padded, conditional (maja alone stays maja, avoids Maja→5) |
| Geographic guard | na północ stays, jest północ → jest 0:00 |
no false 0:00 for north |
Pipeline: lower → brackets/parens → time → decimal ,→.→remove_symbols(keep=".:/%$€£¢+-")→numbers→months (conditional)→dates→ cleanup. Configurable viaPolishTextNormalizer(date_format=...)`.
Installation
uv sync # dev + morfeusz2
uv pip install -e . # editable
# or from PyPI (once published)
uv pip install polish-whisper-normalizer
Requires Python ≥3.10, regex, more-itertools, morfeusz2.
Usage
from polish_whisper_normalizer import PolishTextNormalizer, BasicTextNormalizer
n = PolishTextNormalizer()
n("Było piętnaście po piątej, minus dziesięć stopni.")
# → "było 5:15 -10 stopni"
n("Spotkanie dwudziestego pierwszego maja o piętnastej trzydzieści.")
# → "spotkanie 21.05 o 15:30" # was "21. 5" before 05.05 fix
n("piątego maja roku dwa tysiące dwudziestego szóstego")
# → "05.05.2026" # uniform, no trailing "r"
n("5 maja") # digit day works too
# → "05.05"
n("pięć złotówek, pięć procentów, pół litra, jedna trzecia")
# → "5 zł 5% 0.5 litra 1/3"
# custom date format
PolishTextNormalizer(date_format="%Y-%m-%d")("piątego maja 2026")
# → "2026-05-05"
PolishTextNormalizer(date_format="{day}/{month}/{year}")("piątego maja 2026")
# → "5/5/2026"
# diacritics
BasicTextNormalizer()("Żółć!") # → "żółć"
BasicTextNormalizer(remove_diacritics=True)("Żółć!") # → "zolc"
Components
from polish_whisper_normalizer import PolishNumberNormalizer, PolishTimeNormalizer, PolishLemmatizer
PolishNumberNormalizer()("dwudziestu pięciu złotych") # → "25 zł"
PolishTimeNormalizer()("wpół do ósmej") # → "7:30"
PolishLemmatizer().analyse("dwudziestu") # → [("dwadzieścia","num")]
| Class | Description |
|---|---|
PolishTextNormalizer(date_format="{day:02d}.{month:02d}.{year}") |
Full pipeline, date_format supports str.format ({day}, {month}, {year}) and strftime (%d.%m.%Y) |
PolishNumberNormalizer |
Words → digits, currency/percent/decimals/signs/ordinals |
PolishTimeNormalizer |
Spoken time → HH:MM, guards o 5. stronie vs o 5:00, na północ vs 0:00 |
PolishLemmatizer |
Morfeusz2 wrapper |
BasicTextNormalizer |
Whisper basic but diacritics-aware |
API Docs
Full API: neonfeline.github.io/polish-whisper-normalizer (mkdocs serve locally).
Development
uv sync --group dev
uv run pytest -q # 486 tests
uv run mypy src # strict, py.typed
uv run ruff check src tests && uv run ruff format --check src tests
uv build
mkdocs serve
py.typed+mypy --strict(warn_unused_ignores=false)ruff+pre-commit+ GitHub Actions (ci.yml: lint → mypy → pytest --cov → build)- Validated on BIGOS v2 + PELCRA (2397 samples, ~5 % number words)
License
MIT — see LICENSE (inherits Whisper MIT for basic.py).
Polski
Funkcje
| Obszar | Przykład | Po normalizacji |
|---|---|---|
| Znaki diakrytyczne | Żółć! |
żółć (zachowane) |
| Liczebniki | sto dwadzieścia trzy, pierwszego |
123, 1. |
| Czas | piąta trzydzieści, o piątej, od piątej do szóstej |
5:30, o 5:00, od 5:00 do 6:00 |
| Daty ✨ | 5 maja → 05.05 · piątego maja 2026 → 05.05.2026 |
DD.MM / DD.MM.RRRR, warunkowo (maja samo → maja) |
| Waluta / procent / ułamki | pięć złotówek, procentów, 1/3, pół litra |
5 zł, 5%, 1/3, 0.5 litra |
Potok: lower → czas → liczby → miesiące (warunkowo) → daty.
Instalacja i użycie (PL)
uv sync
from polish_whisper_normalizer import PolishTextNormalizer
n = PolishTextNormalizer() # date_format="{day:02d}.{month:02d}.{year}" domyślnie
n("piątego maja roku dwa tysiące dwudziestego szóstego")
# → "05.05.2026" # jednolicie, bez "r"
n("5 maja") # też działa
# → "05.05"
# własny format daty
PolishTextNormalizer(date_format="%Y-%m-%d")("piątego maja 2026")
# → "2026-05-05"
maja jako imię Maja zostaje maja (nie 5), na północ nie staje się 0:00.
Rozwój / testy
Jak wyżej — uv run pytest, mypy, ruff, mkdocs serve.
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 polish_whisper_normalizer-0.1.0.tar.gz.
File metadata
- Download URL: polish_whisper_normalizer-0.1.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed6a87ec95054091deefcf40adc714e58b178ed87c2dee685c34f22c589d17fc
|
|
| MD5 |
03e53c9158b38472fbcbb5878c4f933d
|
|
| BLAKE2b-256 |
61a65598f1ec9d0cf81c3af328e966f42e7c1911ba452bdb632392e21a8c7b0e
|
Provenance
The following attestation bundles were made for polish_whisper_normalizer-0.1.0.tar.gz:
Publisher:
publish.yml on NeonFeline/polish-whisper-normalizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polish_whisper_normalizer-0.1.0.tar.gz -
Subject digest:
ed6a87ec95054091deefcf40adc714e58b178ed87c2dee685c34f22c589d17fc - Sigstore transparency entry: 2706258876
- Sigstore integration time:
-
Permalink:
NeonFeline/polish-whisper-normalizer@77f82563a754c1a8483010ea7cca90af0fd52acb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NeonFeline
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@77f82563a754c1a8483010ea7cca90af0fd52acb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file polish_whisper_normalizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polish_whisper_normalizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
102d3865348b7077ab10e4699c9d28c0678a0992009ab90b767e9ff72873d2b3
|
|
| MD5 |
ec6c7ed4f53606fa6bd9a05532bda402
|
|
| BLAKE2b-256 |
4d1e5e477a9905d88bef375f44364b50753bbaae6f376b48f98305b0d2b8c2cb
|
Provenance
The following attestation bundles were made for polish_whisper_normalizer-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on NeonFeline/polish-whisper-normalizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polish_whisper_normalizer-0.1.0-py3-none-any.whl -
Subject digest:
102d3865348b7077ab10e4699c9d28c0678a0992009ab90b767e9ff72873d2b3 - Sigstore transparency entry: 2706258895
- Sigstore integration time:
-
Permalink:
NeonFeline/polish-whisper-normalizer@77f82563a754c1a8483010ea7cca90af0fd52acb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NeonFeline
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@77f82563a754c1a8483010ea7cca90af0fd52acb -
Trigger Event:
workflow_dispatch
-
Statement type: