Skip to main content

Module presentation

Module presentation 

Source
Expand description

Presentation / dispatch helpers ported from num2words2/__init__.py.

These three functions were the last pieces of pure-Python logic living in the num2words2 binder: language-code resolution, the style= post-processing, and the cents= mode mapping. They are conversion-agnostic string/enum transforms, so they belong in the pure core rather than the Python surface. The PyO3 binder classifies the caller’s arguments into the plain types below and calls these directly.

Enums§

CentsArg
The cents= argument as the binder classifies the caller’s Python object.

Functions§

apply_style
style= presentation post-processing (issues #535, #562), mirroring num2words2.__init__._apply_style. Operates on the rendered string, so it is conversion-independent:
normalize_cents
cents='omit'|'verbose'|'terse' -> the legacy bool the core expects (issue #554), mirroring num2words2.__init__._normalize_cents plus the caller’s follow-up _cents in (True, False) guard.
resolve_lang
Resolve a caller’s language code to a core key, mirroring the historic dispatcher (num2words2.__init__._normalize_lang):