Skip to main content

PyPI - Version PyPI - Python Version PyPI - Downloads codecov

Numeralform

Numeralform is a typed, locale-aware number-to-words engine for Python. It provides canonical executable support for all 49 Spokenform base language families plus reviewed regional variants. It preserves semantic values, supports explicit syntax and reviewed morphology, exposes capability discovery, and provides a deterministic num2words compatibility adapter.

Install

python -m pip install numeralform

For development:

python -m pip install -e ".[test]"

Versioning

The package version is derived from Git tags by setuptools-scm. Release tags use the form v<version>; the corresponding package version is generated during the build. A source checkout without generated version metadata falls back to 0+unknown.

Quick start

from numeralform import DecimalNumber, DigitSequence, render, realize

render(42, locale="en")
# "forty-two"
render(DigitSequence("0042"), locale="en")
# "zero zero four two"
render(DecimalNumber("1", "20"), locale="en")
# "one point two zero"
result = realize(42, locale="en-US")
# result.locale == "en-US", result.requested_locale == "en-US"

Why Numeralform

Capability Numeralform Legacy num2words style
Leading zeros Preserved by DigitSequence Usually lost
Decimal precision Preserved by DecimalNumber Coerced permissively
Grammar Typed Morphology and Syntax Locale kwargs
Capabilities Exact reviewed profiles Limited discovery
Unsupported requests Explicit errors Varies
Compatibility Separate deterministic adapter Single permissive API

Compatibility

from numeralform.compat import num2words

num2words(42, lang="en")

The runtime adapter is deterministic and does not import upstream num2words. The compatibility profile is pinned to Git revision 07814cb114157f582c40a00119c2e9faba8dcee2 with package metadata 0.5.14.

Development tests

The default suite contains only small Numeralform tests. It needs no benchmark data, network access, ICU, or external num2words package:

python -m pytest

Coverage, lint, formatting, and build checks are described in the release procedure.

Explicit benchmarks

Oracle, corpus, differential, and upstream compatibility work is separate from unit tests:

python -m benchmarks.download num2words
python -m benchmarks.run num2words
python -m benchmarks.run cldr
python -m benchmarks.run all
python -m pytest benchmarks/tests

Benchmark data and reports are generated locally under benchmarks/data/ and are not required for normal tests.

CLI

numeralform 42 --locale en
numeralform 0042 --locale en --digits
numeralform --version
numeralform --list-locales
numeralform --capabilities ru

See the API reference, locale inventory, compatibility contract, and release procedure.

Release files for numeralform 0.1.9

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

Source distribution (sdist)

Source distribution for numeralform 0.1.9
File Size Uploaded
numeralform-0.1.9.tar.gz 885.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for numeralform 0.1.9
File Interpreter ABI Platform
numeralform-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / numeralform-0.1.9.tar.gz

Download URL numeralform-0.1.9.tar.gz
Size 885.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6cf316429e5fb087a6f4823cb184772b73771e4af863112b30adccd8b4fc9fa8
BLAKE2b-256 checksum
How to use checksums
1c5006c97d029fc089f0d531f3d92ea370adf798791fa71284bd09d6cd6078ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / numeralform-0.1.9-py3-none-any.whl

Download URL numeralform-0.1.9-py3-none-any.whl
Size 421.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56e592860d733df740db627a712e6fddd5875b2c6ef45cb45bee85c4a995a85e
BLAKE2b-256 checksum
How to use checksums
4dfbdd9fcf5c3de4683c8d9df8f6b53327603e44d186f0ba33c8be2f33bfce93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.0

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