numtofi
is a Python module that offers functionality to convert integers into their Finnish textual representation. This module also comes with a command-line interface (CLI) tool to quickly get the Finnish representation for any number from the command line.
pip install numtofi
from numtofi import number_to_text
print(number_to_text(45)) # Outputs "neljäkymmentäviisi"
After installation, you can use the numtofi
command directly from your terminal:
$ numtofi 45
neljäkymmentäviisi
$ numtofi 5000000
viisi miljoonaa
$ numtofi 5000000 --nospaces
viisimiljoonaa
$ numtofi 5000000 --length
15
-
number_to_text(n, spaces=False)
:n (int)
: The number to convert.spaces (bool)
: IfFalse
, removes spaces between words. Default isTrue
.
-
number_to_text_length(n, spaces=False)
:n (int)
: The number to the length of the textual representation.spaces (bool)
: IfFalse
, removes spaces between words. Default isTrue
.
Tests are provided in the tests
directory. To run the tests:
- Navigate to the project root directory.
- Run:
python -m unittest discover tests
python setup.py sdist bdist_wheel
python -m twine upload dist/*
Contributions are welcome! Please make sure to update tests as appropriate when proposing changes.