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

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.4
File Size Uploaded
numeralform-0.1.4.tar.gz 776.7 kB Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / numeralform-0.1.4.tar.gz

Download URL numeralform-0.1.4.tar.gz
Size 776.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1a68f1d0cc4eaecfcd13f0f9e22e8452c673af0a3691584307d70457d376b317
BLAKE2b-256 checksum
How to use checksums
0867081f62bf139970f7671335cf6b74a7adf3b73c312d7a69db90001b339db6
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.4-py3-none-any.whl

Download URL numeralform-0.1.4-py3-none-any.whl
Size 393.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4269fbec64935bb4d93ea0058017beb88d43dd7e816b11b1f5c5f798582792be
BLAKE2b-256 checksum
How to use checksums
9e85c0dcc1f03902a520548ac9158e58a40179ff64fd61af1b6d934e81eb8bf0
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

0.1.5

2 release files

This release

0.1.4 This release

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