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

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.7
File Size Uploaded
numeralform-0.1.7.tar.gz 824.7 kB Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / numeralform-0.1.7.tar.gz

Download URL numeralform-0.1.7.tar.gz
Size 824.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1083a4ef098883d9952b05984564ee3ab8402f578a8c20eca130997a1d07e3f1
BLAKE2b-256 checksum
How to use checksums
af63a0bc79b6f9c0ecca99acded102488b4079de359458fee619bf3193a00607
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.7-py3-none-any.whl

Download URL numeralform-0.1.7-py3-none-any.whl
Size 395.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74d9dea93bcbdda8c74c263206b414641cc34d70f4536910c1001b204be539eb
BLAKE2b-256 checksum
How to use checksums
5ffdbcb7028521542fa6227d3347933114b0f79f81dd4af9eb84e921a4625eb1
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

This release

0.1.7 This release

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