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.5

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.5
File Size Uploaded
numeralform-0.1.5.tar.gz 784.1 kB Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / numeralform-0.1.5.tar.gz

Download URL numeralform-0.1.5.tar.gz
Size 784.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b52315062707550b6e94538e8cfda47c9445f056dce7cc19aa13c9890942064a
BLAKE2b-256 checksum
How to use checksums
e9b83b0603a7ef7b4b985abc4040f1d9d07ffac226f4ebcf810dcfd8687d7987
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.5-py3-none-any.whl

Download URL numeralform-0.1.5-py3-none-any.whl
Size 393.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0275f83ef484f23ddc5db9f7c332a14ca4bda5c3b60d78bee0a9ea66070e3c67
BLAKE2b-256 checksum
How to use checksums
96d85dc5b9f31be160b32504d9acc2f9c6d17b9a4ce05d3315edb937bc1602a2
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

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

This release

0.1.5 This release

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