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 noun8 שעות → שמונה (feminine), 8 שקלים → שמונה (masculine); the noun after the numeral decides, which is the part naive expanders get wrong.
  • Construct forms2 ספרים → שני, 2 מכוניות → שתי (not שניים / שתיים).
  • Bare numerals — a count with no noun takes the absolute (feminine) series, except 1 → אחד.
  • Clock times14:45 is spoken 12-hour and feminine, with ורבע / וחצי / רבע ל־ / עשרים ל־.
  • Percents12% → masculine cardinal + אחוז.
  • Dates3.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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hebrew_num2words-0.1.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hebrew_num2words-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file hebrew_num2words-0.1.0.tar.gz.

File metadata

  • Download URL: hebrew_num2words-0.1.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for hebrew_num2words-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ef218dc8d9a781772408a6b5977049e2f4e51036891f1eae8f5dfa9855b3d33d
MD5 5cea76cd69e8901d0459b949556727f0
BLAKE2b-256 e48dea8d1fa49cf9db71cd2e7a04a7f73209acd98bfef9990df9f600a7c90265

See more details on using hashes here.

File details

Details for the file hebrew_num2words-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hebrew_num2words-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for hebrew_num2words-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e63bae884cc4aafce01ce4d5dc0e7fb747ede824b15820d20dacde7fdab432b9
MD5 9a1fa8bb9b88ac8437a79b76ffc7a7ac
BLAKE2b-256 fb22b3dd47062cff6004fb3574f3e755d3f4eb5e51e262848c5b21f1e24ca094

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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