Skip to main content

Ukrainian ITN

CI PyPI version

Fast WFST-based Inverse Text Normalization (ITN) for Ukrainian. The Python package uses a Rust runtime and ships with compiled grammars, so using it does not require Pynini, OpenFST, or a C++ toolchain.

Supported semiotic classes: cardinal, ordinal, decimal, fraction, measure, money, date, time, telephone, electronic (e-mail/URL), century (Roman numerals), number sign (№), ranges (numeric/time/date), durations & half-quantities, decades, legal references, scores, versions, IPv4, postal codes, street addresses. Also supports high-priority spoken abbreviations and time day-period/time-zone forms. Punctuation-aware (built for ASR output): "сто гривень, будь ласка!" -> ₴100, будь ласка!, "нуль шістдесят сім, сто двадцять три, сорок п'ять, шістдесят сім" -> 0671234567 Common Ukrainian apostrophes (', ’, ʼ) and uppercase ASR/text input are accepted without changing the spelling or case of ordinary words.

Installation

pip install ukrainian_itn

Installing from source also requires a current Rust toolchain. Published wheels include the compiled extension and grammar files.

Usage

from ukrainian_itn import normalize

normalize("це трапилося дві тисячі дев'ятнадцятого числа")  # це трапилося 2019-го числа
normalize("мінус п'ять цілих одна десята відсотка")  # -5.1 %
normalize("двадцять дві тисячі сто один")  # 22101
normalize("сьома година двадцять п'ять хвилин")  # 07:25
normalize("МІНУС П’ЯТЬ ГРИВЕНЬ")  # -₴5
normalize("третя година дня за київським часом")  # 15:00 Europe/Kyiv
normalize("підключи ю ес бі та вай фай")  # підключи USB та Wi-Fi

The bundled grammars are loaded lazily on the first call and cached for the lifetime of the process. normalize is thread-safe.

From command line

echo "це трапилося дві тисячі дев'ятнадцятого числа" | python -m ukrainian_itn
# or, after `pip install ukrainian_itn`:
echo "це трапилося дві тисячі дев'ятнадцятого числа" | ukrainian-itn
Options:
  -h, --help     Show this help message and exit
  -j, --json     Return result as JSON
  -v, --verbose  Print original input and normalized to compare
  --version      Show version

Will return це трапилося 2019-го числа. Lines the grammar cannot parse are reported to stderr and skipped (exit code 1).

JSON output

For more advanced usage you can get json output

from ukrainian_itn import normalize

normalize("це трапилося дві тисячі дев'ятнадцятого числа", json=True)
# >>> '[{"word": "це"}, {"word": "трапилося"}, {"ordinal": "2019"}, {"word": "числа"}]'

The returned string is guaranteed to be valid JSON, including when pass-through tokens contain quotes, backslashes, control characters, or non-BMP Unicode.

Rust runtime

The reusable crate uses rustfst and can be embedded in another Rust application without Python or PyO3 at runtime. To regenerate/export grammars, install the optional grammar tooling first:

pip install "ukrainian_itn[grammar]"
python -m ukrainian_itn.export grammars_export
cargo test
cargo build --release
echo "двадцять дві тисячі сто один" | ./target/release/ukrainian_itn_cli  # 22101

The repository root is also the reusable Rust crate. Its default feature set is PyO3-free, so another Rust application can depend on it directly:

[dependencies]
ukrainian-itn = { git = "https://github.com/RustedBytes/ukrainian-itn" }
use ukrainian_itn::InverseNormalizer;

let normalizer = InverseNormalizer::new()?;
assert_eq!(normalizer.normalize("двадцять дві тисячі сто один")?, "22101");
# Ok::<(), anyhow::Error>(())

Python bindings are available behind the optional python Cargo feature. Maturin enables that feature when building the Python wheel; ordinary Rust builds leave it disabled. Backend-specific Python types remain internal so the public Python API is implementation-independent.

Grammar development

Pynini is only used to edit, test, and recompile the grammar definitions. It is not imported by the public Python API and is not an installation dependency. Install it with:

pip install "ukrainian_itn[grammar]"

On platforms without a Pynini wheel, OpenFST development headers may also be needed. The grammar tooling exposes taggers and verbalizers directly. For example:

from ukrainian_itn.wfst import get_normalizer, apply_fst_text

apply_fst_text("мінус п'ять цілих одна десята відсотка", get_normalizer().classify.fst)

This returns tokens { measure { negative: "true" integer_part: "5" fractional_part: "1" units: "%" } }.

Development

uv sync                         # install the native package and standard test tools
uv sync --extra grammar         # additionally install Pynini for grammar work/full tests
uv run pytest          # run tests
uv run ruff check .    # lint
uv build               # build sdist + wheel

Releasing

The release workflow runs when a v* tag is pushed. The tag must match the version in pyproject.toml, Cargo.toml, and ukrainian_itn/__init__.py:

git tag v0.4.2
git push origin v0.4.2

It builds an sdist and ABI3 wheels for Linux (x86-64 and ARM64), macOS (Intel and Apple Silicon), and Windows (x86-64), publishes them to PyPI, and attaches them to a GitHub Release. PyPI trusted publishing must be configured for the RustedBytes/ukrainian-itn repository, .github/workflows/release.yml workflow, and pypi environment. The PyPI project name must be ukrainian-itn (the canonical form of the distribution metadata name ukrainian_itn), not the legacy distribution name ukr-itn.

Metadata

Release files for ukrainian-itn 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ukrainian-itn 0.4.2
File Size Uploaded
ukrainian_itn-0.4.2.tar.gz 1.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for ukrainian-itn 0.4.2
File
ukrainian_itn-0.4.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
ukrainian_itn-0.4.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
ukrainian_itn-0.4.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
ukrainian_itn-0.4.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
ukrainian_itn-0.4.2-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 11.8 MB

Release files / ukrainian_itn-0.4.2.tar.gz

Download URL ukrainian_itn-0.4.2.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
d04c1deb1382507d58eacd3b149356d8a4632b3cba6bdd47c684e294443904e5
BLAKE2b-256 checksum
How to use checksums
4d4feb0c6506189d2aac407da5c06ba82115651319985be046a380f4b2b24ced
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 Sep 21, 2026.

Transparency log

Release files / ukrainian_itn-0.4.2-cp39-abi3-win_amd64.whl

Download URL ukrainian_itn-0.4.2-cp39-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e7b02c613df1982056c47aca54198964b216934fbfcc098154ae5777a7d65ef7
BLAKE2b-256 checksum
How to use checksums
c247b049785ac30ead237f30b3190fd27ee6ad4e1c68ca9754d0481561578c34
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 Sep 21, 2026.

Transparency log

Release files / ukrainian_itn-0.4.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ukrainian_itn-0.4.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2b767cdef18e8c51bd6095de7ae1452b9965f8120fed1ce593f365755e41b5d6
BLAKE2b-256 checksum
How to use checksums
b45d30de2da37dc575e76326ebccc83aae7718f58225bfa6dbf37dc7e1fda927
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 Sep 21, 2026.

Transparency log

Release files / ukrainian_itn-0.4.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL ukrainian_itn-0.4.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
89fa90fedfc8fb600466ce340d537f4d92df81da75d238778d9a53d366cbd8a6
BLAKE2b-256 checksum
How to use checksums
4152639c739d17425d286573fa740af0e654b4d33eb7651a5579633bdab64bba
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 Sep 21, 2026.

Transparency log

Release files / ukrainian_itn-0.4.2-cp39-abi3-macosx_11_0_arm64.whl

Download URL ukrainian_itn-0.4.2-cp39-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
182cebfe170af91c409d0d6e12301fdfd40cb14a74ae48384a8dbf282fb3ab42
BLAKE2b-256 checksum
How to use checksums
f239cb1ae6e516278de93e57ae86c70a122401b5952b10190563d86ed0eb5e58
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 Sep 21, 2026.

Transparency log

Release files / ukrainian_itn-0.4.2-cp39-abi3-macosx_10_12_x86_64.whl

Download URL ukrainian_itn-0.4.2-cp39-abi3-macosx_10_12_x86_64.whl
Size 2.1 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6e1dd80b7bfad8e9e62b4ab62b5fe00c736e2674731807c7fb2b0ac90b8b530e
BLAKE2b-256 checksum
How to use checksums
992ed9e5e64dc85190247df1b687b24a73b1edbc0b528db9de4e32121ee41c5a
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 Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.2 This release

6 release files

0.4.1

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page