heb-tts-normalizer (Python)
Normalize Hebrew text for TTS: numbers, currency, dates, times and units become spoken words, ready for g2p. Output is plain Hebrew, never niqqud.
from heb_tts_normalizer import normalize
normalize("יש לי 3 ילדים ו-25₪")
# 'יש לי שלושה ילדים ועשרים וחמישה שקלים'
The rules live in Rust. This package is a ctypes binding over the C ABI in
crates/heb-tts-normalizer-c — no runtime dependencies, and nothing to compile at
install time.
Reading style
from heb_tts_normalizer import Clock, Config, Gender, HebrewDateStyle, normalize
cfg = Config(
clock=Clock.H24,
hebrew_date_style=HebrewDateStyle.NUMBERS,
gender_overrides={"וופל": Gender.MASC},
)
normalize("14:30", cfg)
Config mirrors the Rust struct field for field: clock, date_order,
hebrew_date_style, default_currency, read_minor_currency, decimal_word,
expand_units, expand_abbreviations, strip_markdown, clean_whitespace,
gender_overrides. Enum fields also accept their bare string value (clock="24").
An unknown field value raises NormalizerError carrying the message Rust produced —
the config is validated on the Rust side, so the two can never drift.
Handles are cached per distinct config, so repeated calls with the same Config pay
the JSON parse once.
Finding the native library
heb_tts_normalizer._ffi looks for libheb_tts_normalizer_c.dylib (macOS),
libheb_tts_normalizer_c.so (Linux) or heb_tts_normalizer_c.dll (Windows), in this
order:
$HEB_TTS_NORMALIZER_LIB, if set — a full path to the library. An explicit path is treated as a promise: if it is wrong you get an error, not a silent fallback.- Next to
__init__.py, and in alib/subdirectory beside it. This is where the wheel bundles it, so an installed package never picks up a stale build from a checkout that happens to be on the path. - The workspace
target/releasethentarget/debug, found by walking up from the package to the first ancestor holding both aCargo.tomland atarget/. Release is preferred: a debug build of the regex engine is slow enough to be misleading. - The platform loader's own search path (
ctypes.util.find_library).
Failing all four raises LibraryNotFound, listing the directories it tried.
heb_tts_normalizer.library_path reports which file was actually loaded, and
version() reports the native library's version — worth checking when a checkout and
an installed wheel disagree.
Developing
cargo build --release -p heb-tts-normalizer-c # step 3 above finds this
cd bindings/python && uv run pytest
To build a wheel, copy the compiled library next to src/heb_tts_normalizer/__init__.py
first; pyproject.toml lists it under tool.hatch.build.targets.wheel.artifacts so it
is included when present. Wheels are per-platform and must be tagged accordingly.
Differences from the pure-Python release
normalize(text, cfg=None) and Config are unchanged. The rule-authoring surface is
gone — Rule, scan, PRIORITY and ALL_RULES were Python-level extension points
and have no equivalent across the C ABI; write a rule in Rust instead. Config is a
plain str-valued Enum rather than StrEnum, because this package supports Python
3.9; comparisons against plain strings still work.
Metadata
Release files for heb-tts-normalizer 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| heb_tts_normalizer-0.2.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| heb_tts_normalizer-0.2.0-py3-none-musllinux_1_2_x86_64.whl | Python 3 | none | Linux musl 1.2+ x86-64 | Details |
| heb_tts_normalizer-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| heb_tts_normalizer-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| heb_tts_normalizer-0.2.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| heb_tts_normalizer-0.2.0-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details |
Total release size: 5.0 MB
Release files / heb_tts_normalizer-0.2.0-py3-none-win_amd64.whl
| Download URL | heb_tts_normalizer-0.2.0-py3-none-win_amd64.whl |
|---|---|
| Size | 741.7 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
036ba2acf2f6083a889cbf4f474ae3c0f9308b4c287c791e8c000a44419d55cc
|
|
BLAKE2b-256 checksum How to use checksums |
9c0847879aee5f7c0a77e6c9115230a69a68579101b26b9a3642ed4c7c592ee6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / heb_tts_normalizer-0.2.0-py3-none-musllinux_1_2_x86_64.whl
| Download URL | heb_tts_normalizer-0.2.0-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 935.7 kB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
d272d2d1d0ddbf82c71568c06cc538d904ab40c3ef30aa6e118e4431a1cb10f5
|
|
BLAKE2b-256 checksum How to use checksums |
1310540b12de1fccb79c705773bceb139c145c01301d4d08b3a6b140229ed6ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / heb_tts_normalizer-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | heb_tts_normalizer-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 917.7 kB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
db2283b959d541d2b1f3dccb563d6969ff87605f730a83db8145a10146ccbc0c
|
|
BLAKE2b-256 checksum How to use checksums |
8501475821dd4cbd65d3bc87ba34c681aa2410c1bc854a23779936221201ad3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / heb_tts_normalizer-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | heb_tts_normalizer-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 873.9 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
a6b5bee4e1e9b9f22daefde5d311cd5c5a0a0aaff04227c84fdea721a30ef2f2
|
|
BLAKE2b-256 checksum How to use checksums |
b40231f7294def4ab18041449618845c6d6786a4b2bb1fc6bae146fe8e41ae53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / heb_tts_normalizer-0.2.0-py3-none-macosx_11_0_arm64.whl
| Download URL | heb_tts_normalizer-0.2.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 778.3 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0eef9524f114fcf1d081b9da9f1d2b2d3630f2f990ca0d9b2b3946bdfe983b8d
|
|
BLAKE2b-256 checksum How to use checksums |
32cb47fa30f8148d68d52cfad82955c91aafa12fecf4dd379df694798e270f7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / heb_tts_normalizer-0.2.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | heb_tts_normalizer-0.2.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 802.7 kB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f9c2fd1ced5a81b0369e006c1f3d0e8c3bf9a52ece6fb25b429a0bdf9bc5bf4a
|
|
BLAKE2b-256 checksum How to use checksums |
e30d9b77f6d067d0769871103f80f4f76285d285494a9574e98ef7f7ecd36e7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|