diff --git a/README.en.md b/README.en.md index 1e43447544729231c6332d28eb04ea44aa224348..4d7ee22af8c77798340e48281800c1466a2ca725 100644 --- a/README.en.md +++ b/README.en.md @@ -1,22 +1,56 @@ # python-num2words #### Description -Modules to convert numbers to words. Easily extensible. +num2words is a library that converts numbers like 42 to words like forty-two. It supports multiple languages (see the list below for full list of languages) and can even generate ordinal numbers like forty-second (although this last feature is a bit buggy for some languages at the moment). #### Software Architecture -Software architecture description + +noarch #### Installation -1. xxxx -2. xxxx -3. xxxx +The easiest way to install num2words is to use pip: + +`pip install num2words` + +Otherwise, you can download the source package and then execute: + +`python setup.py install` + +The test suite in this library is new, so it’s rather thin, but it can be run with: + +`python setup.py test` + +To run the full CI test suite which includes linting and multiple python environments: +``` +pip install tox +tox +``` #### Instructions -1. xxxx -2. xxxx -3. xxxx +Command line: +``` +$ num2words 10001 +ten thousand and one +$ num2words 24,120.10 +twenty-four thousand, one hundred and twenty point one +$ num2words 24,120.10 -l es +veinticuatro mil ciento veinte punto uno +$num2words 2.14 -l es --to currency +dos euros con catorce centimos +``` +In code there’s only one function to use: +``` +>>> from num2words import num2words +>>> num2words(42) +forty-two +>>> num2words(42, to='ordinal') +forty-second +>>> num2words(42, lang='fr') +quarante-deux +``` +Besides the numerical argument, there are two main optional arguments. #### Contribution diff --git a/num2words-0.5.10.tar.gz b/num2words-0.5.10.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..31e0c6fcfbec30f76ef3bba9d29a2d0ed218eec0 Binary files /dev/null and b/num2words-0.5.10.tar.gz differ diff --git a/python-num2words.spec b/python-num2words.spec new file mode 100644 index 0000000000000000000000000000000000000000..88470b302bb352965d241ae1ad2df8f6ef64a9e5 --- /dev/null +++ b/python-num2words.spec @@ -0,0 +1,58 @@ +%bcond_with tests + +%global pypi_name num2words + +%global _description %{expand: +Convert numbers to words in multiple languages, it is a library that converts +numbers like ``42`` to words like ``forty-two``. It supports multiple +languages (English, French, Spanish, German and Lithuanian) and can even +generate ordinal numbers like ``forty-second``.} + +Name: python-%{pypi_name} +Version: 0.5.10 +Release: 5%{?dist} +Summary: Module to convert numbers to words + +License: LGPL-2.1-only +URL: https://github.com/savoirfairelinux/num2words +Source0: %{pypi_source} + +BuildArch: noarch + +%description %_description +%{?python_enable_dependency_generator} + +%package -n python3-%{pypi_name} +Summary: Python 3 modules to convert numbers to words +BuildRequires: python3-setuptools +BuildRequires: python3-devel + +%if %{with tests} +BuildRequires: %{py3_dist delegator.py} +%endif + +%{?python_provide:%python_provide python3-%{pypi_name}} + +%description -n python3-%{pypi_name} %_description +%prep +%autosetup -n %{pypi_name}-%{version} +# Remove bundled egg-info +rm -rf %{pypi_name}.egg-info + +%build +%py3_build +%install +%py3_install +%if %{with tests} +%check +%{__python3} setup.py test +%endif + +%files -n python3-%{pypi_name} +%doc README.rst +%license COPYING +%{_bindir}/%{pypi_name} +%{python3_sitelib}/%{pypi_name} +%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info + +%changelog