Skip to main content

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:

  1. $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.
  2. Next to __init__.py, and in a lib/ 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.
  3. The workspace target/release then target/debug, found by walking up from the package to the first ancestor holding both a Cargo.toml and a target/. Release is preferred: a debug build of the regex engine is slow enough to be misleading.
  4. 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.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for heb-tts-normalizer 0.1.0
File
heb_tts_normalizer-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
heb_tts_normalizer-0.1.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
heb_tts_normalizer-0.1.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.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
heb_tts_normalizer-0.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
heb_tts_normalizer-0.1.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.1.0-py3-none-win_amd64.whl

Download URL heb_tts_normalizer-0.1.0-py3-none-win_amd64.whl
Size 741.4 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
118fc5f5a0136c541ee179668e35050433d20a4555bd33d0272196f954fb6b4e
BLAKE2b-256 checksum
How to use checksums
d31dd1053910aeda0060a32621af05fc2fd7517f0dd8453492459b79f87168e7
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.1.0-py3-none-musllinux_1_2_x86_64.whl

Download URL heb_tts_normalizer-0.1.0-py3-none-musllinux_1_2_x86_64.whl
Size 935.5 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
516628b49af52f15a3c0a1a33c4cdd6bc964dc432f358e7e57d62eb2193a49ce
BLAKE2b-256 checksum
How to use checksums
119e3c8eafa936e387da0a37e0174ccfa4b10b2bf27565f882b1ed444a590a98
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.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL heb_tts_normalizer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 917.5 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
99d96c6214453e513b27199942138ef5dacb7a2c7ee9b616183e3ccf015a628f
BLAKE2b-256 checksum
How to use checksums
95066bf9b9776d5a31fd06d92fbc922b60ed6b3eac6e6d375370c9a4631e3863
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.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL heb_tts_normalizer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 873.6 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
32db21819afebf8a266748817026e932d684cf8bd69796c80acbdcfc103bb43e
BLAKE2b-256 checksum
How to use checksums
a3a5c949e59a4bcb7a339ea79a5e2217213fbf78f2adfde7169593deae48f831
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.1.0-py3-none-macosx_11_0_arm64.whl

Download URL heb_tts_normalizer-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 777.8 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0f2937737a54030d2421bd39abe7c1787bd22a3f8b25c96afd86dc1b906cbc1c
BLAKE2b-256 checksum
How to use checksums
7de973701b26c8d74d7519695f74e4ceb5eb29e850a25b8bf125bbf6f0f76765
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.1.0-py3-none-macosx_10_12_x86_64.whl

Download URL heb_tts_normalizer-0.1.0-py3-none-macosx_10_12_x86_64.whl
Size 802.5 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
85a2afb7ec00e870760428463edb6c39f29176861c8d39aee37c9495f575d98c
BLAKE2b-256 checksum
How to use checksums
04e9425c1b3a21745fe3909c2fb682ab7809c7dce598a27f8994d199e5f8d76e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release history Release notifications | RSS feed

0.2.0

6 release files

This release

0.1.0 This release

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