A small package for handy conversion of german numerals (also ordinal / signed) written as words to numbers.
Project description
zahlwort2num
:de: :de: :de: A small but useful (due shortage of/low quality support for lang_DE) package for handy convertion of german numerals (also ordinal) written as words to numbers.
This might be a good complementary lib to https://github.com/savoirfairelinux/num2words
:crying_cat_face: Currently is doesn't support swiss variant. TBD :switzerland:
Installation
pip2 install zahlwort2num
Usage
Definition:
import zahlwort2num as w2n
Example:
w2n.convert("Zweihundertfünfundzwanzig") # => 225
w2n.convert("neunte") # => '9.'
w2n.convert("minus siebenhundert millionen achtundsiebzig") # => -700000078
or even stuff like:
w2n.convert("sechshundertdreiundfünfzigtausendfünfhunderteinundzwanzig") # => 653521
:see_no_evil:
Command line
- (Obviously it is better to use parameter inside apostroph due possible spaces)
bin/zahlwort2num-convert "ein million siebenhunderteinundzwanzig"
WIKI
TBD
TODO / Known issues
-
Make POC, functional for all common cases -
Ordinal number support -
Take care for exceptions / trailing whitespaces etc. -
Make structure + publish as PyPI package - Command line support :computer:
- More comprehensible tests
- Swiss variant
- More fault tolerant (ß -> ss) etc
- Larger scale than 10^60
- Ordinal with very large numbers (without addons) e.g
Millionste
- Few benchmark improvements (e.g tail recursion etc)
- Better error handling + validation for idiotical cases (e.g
minus null Miliarde
) - Simplify/refactor POC code, add better documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zahlwort2num-0.1.2.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for zahlwort2num-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0244b1ca15ae6ea14f6c13e64720980a247ccfbd6efc5be14be6c8d3dd8c7725 |
|
MD5 | d113a7ddbeee29f60a00307bc3d634ec |
|
BLAKE2b-256 | 9da3ca86265cced0a76d9f39df081dd107f5e307045dbf968cd1b759106e6728 |