Skip to main content

hebrew-num2words

Turn digits in Hebrew text into spoken Hebrew words. Pure Python, no dependencies.

pip install hebrew-num2words
from hebrew_num2words import normalize_numbers

normalize_numbers("יש לי 3 ילדים")        # יש לי שלושה ילדים
normalize_numbers("יש לי 3 בנות")         # יש לי שלוש בנות
normalize_numbers("המחיר 1250 שקלים")     # המחיר אלף מאתיים וחמישים שקלים
normalize_numbers("נפגשים ב-15 במרץ")     # נפגשים בחמישה עשר במרץ
normalize_numbers("השעה 14:45")           # השעה רבע לשלוש
normalize_numbers("עלייה של 3.5%")        # עלייה של שלושה וחצי אחוז

Digit-free text is returned unchanged, byte for byte.

What it handles

  • Gender agreement with the counted noun — 8 שעות → שמונה (feminine), 8 שקלים → שמונה (masculine); the noun after the numeral decides, which is the part naive expanders get wrong.
  • Construct forms — 2 ספרים → שני, 2 מכוניות → שתי (not שניים / שתיים).
  • Bare numerals — a count with no noun takes the absolute (feminine) series, except 1 → אחד.
  • Clock times — 14:45 is spoken 12-hour and feminine, with ורבע / וחצי / רבע ל־ / עשרים ל־.
  • Percents — 12% → masculine cardinal + אחוז.
  • Dates — 3.5.2026 → masculine day + ב+month + feminine year.
  • Identifiers — phone numbers, ID numbers and codes are read digit by digit.
  • Ordinals and definite forms — ה-2 → השני.

API

normalize_numbers(text: str) -> str          # expand every numeric expression in a sentence
expand_token(token, prev_words=(), next_words=()) -> str
cardinal(n: int, gender: str, construct: bool = False) -> str    # 0..999,999
ordinal(n: int, gender: str, definite: bool = False) -> str

gender is MASC or FEM, exported from the package.

Where the rules come from

Every convention was mined from a 473-row Hebrew↔IPA gold set of spoken numbers, not hand-invented. On that set the expander takes word error rate from 50.04 to 13.52. 115 unit tests cover the cases above.

It exists because grapheme-to-phoneme models are typically trained on text that contains no digits at all, so a digit reaching the model produces guaranteed-wrong output — and often corrupts the word after it. Normalizing first removes the whole class.

License

Apache-2.0.

Metadata

Release files for hebrew-num2words 0.1.0

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

Source distribution (sdist)

Source distribution for hebrew-num2words 0.1.0
File Size Uploaded
hebrew_num2words-0.1.0.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hebrew-num2words 0.1.0
File Interpreter ABI Platform
hebrew_num2words-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / hebrew_num2words-0.1.0.tar.gz

Download URL hebrew_num2words-0.1.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ef218dc8d9a781772408a6b5977049e2f4e51036891f1eae8f5dfa9855b3d33d
BLAKE2b-256 checksum
How to use checksums
e48dea8d1fa49cf9db71cd2e7a04a7f73209acd98bfef9990df9f600a7c90265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / hebrew_num2words-0.1.0-py3-none-any.whl

Download URL hebrew_num2words-0.1.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e63bae884cc4aafce01ce4d5dc0e7fb747ede824b15820d20dacde7fdab432b9
BLAKE2b-256 checksum
How to use checksums
fb22b3dd47062cff6004fb3574f3e755d3f4eb5e51e262848c5b21f1e24ca094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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