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 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]"

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

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.0
File Size Uploaded
numeralform-0.1.0.tar.gz 76.9 kB Details

Built distribution (wheel)

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

Total release size: 155.4 kB

Release files / numeralform-0.1.0.tar.gz

Download URL numeralform-0.1.0.tar.gz
Size 76.9 kB
Tags Source
SHA-256 checksum
How to use checksums
00191b261d5d3b042e1115760f84ef1385d16a75e5caa8413f982d1d3b96c4be
BLAKE2b-256 checksum
How to use checksums
ca025dc80beaab7ff54f91e973e928b63aee8ad7ba991e1eaf63517fd646ae2b
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.0-py3-none-any.whl

Download URL numeralform-0.1.0-py3-none-any.whl
Size 78.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc983c8063ab3e5ea4e8b4745cff0188c302420529cb26499d7ebb712a82e4b9
BLAKE2b-256 checksum
How to use checksums
4b610db1ce7ad31fd9ee7133be3b08ca4fbf71f6d5a3b54b4673ba5f423400d0
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

0.1.4

2 release files

This release

0.1.0 This release

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