Skip to main content

Telwoord

A Python library to convert numbers into their Dutch (nl) written form.

URL: https://github.com/wbolster/telwoord

Installation

To install from a source tree:

$ pip install -e .

Eventually this will become:

$ pip install telwoord

There are no dependencies; a Python 2 or Python 3 interpreter is all you need.

Usage

Use telwoord.cardinal() to convert an integer to its string representation.

By default, a friendly representation is used, based on some common style recommendations:

>>> from telwoord import cardinal

>>> numbers = (0, 1, 2, 3, 19, 20, 30, 31, 100, 200, 215, 300, 14999, 15000, 1000000, 12345678)

>>> [cardinal(n) for n in numbers]
['nul', 'een', 'twee', 'drie', 'negentien', 'twintig', 'dertig', '31', 'honderd', 'tweehonderd', '215', 'driehonderd', '14999', '15 duizend', '1 miljoen', '12345678']

If you are not in a friendly mood though, you can forcibly spell out all the numbers as well:

>>> [cardinal(n, friendly=False) for n in numbers]
['nul', 'een', 'twee', 'drie', 'negentien', 'twintig', 'dertig', 'eenendertig', 'honderd', 'tweehonderd', 'tweehonderdvijftien', 'driehonderd', 'veertienduizend negenhonderdnegenennegentig', 'vijftienduizend', 'een miljoen', 'twaalf miljoen driehonderdvijfenveertigduizend zeshonderdachtenzeventig']

Rules and style recommendations

Development

To run the tests:

$ py.test

Possible future work:

  • Ordinal numbers

  • Fractions

Release files for telwoord 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telwoord 0.1
File Size Uploaded
telwoord-0.1.tar.gz 2.7 kB Details

Release files / telwoord-0.1.tar.gz

Download URL telwoord-0.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e746830d252b2fdbcfc1eb2cb08874081f0b14338e5a4b1e524368c79b4c0665
BLAKE2b-256 checksum
How to use checksums
1ce5d36d8ae0e6cf2263a2616b14d9a3ab23aff33d90a8452efd3bdb5c16636f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.2dev

This release

0.1 This release

1 release file

0.1dev

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