%global _empty_manifest_terminate_build 0
Name: python-zahlwort2num
Version: 0.4.2
Release: 1
Summary: A small package for handy conversion of german numerals (also ordinal / signed) written as words to numbers.
License: MIT License
URL: https://github.com/walu2/zahlwort2num
Source0: https://mirrors.aliyun.com/pypi/web/packages/79/6a/e58ad1e9ee67d4395f1ceafde041f9524ac67d276dda0e687841c2e2be6a/zahlwort2num-0.4.2.tar.gz
BuildArch: noarch
Requires: python3-markdown
%description
# ZahlWort2num (v.0.4.2)
:de: :de: :de:
A small but useful (due shortage of/low quality support for `lang_de`) package for handy conversion of german numerals (incl. ordinal number) written as string to the from numbers.
To put it differently: _It allows reverse text normalization for numbers_.
This package might be a good complementary lib to https://github.com/savoirfairelinux/num2words
:crying_cat_face: _Currently is doesn't support swiss variant. TBD_ :switzerland:
# PyPi direct page of project
https://pypi.org/project/zahlwort2num/
# Installation
`pip2 install zahlwort2num`
# Usage
### _Definition_:
```python
import zahlwort2num as w2n
```
### _Few examples_:
```python
w2n.convert('Zweihundertfünfundzwanzig') # => 225
w2n.convert('neunte') # => '9.'
w2n.convert('minus siebenhundert Millionen achtundsiebzig') # => -700000078
```
_or even stuff like:_ :see_no_evil:
```python
w2n.convert('sechshundertdreiundfünfzigtausendfünfhunderteinundzwanzig') # => 653521
```
#### Command line:
* _(Obviously it is better to use a parameter enclosed with apostrophs due to possible spaces)_
```
bin/zahlwort2num-convert 'eine Million siebenhunderteinundzwanzig'
```
# Development
Before doing anything. Install flake8 locally by
```bash
python3 -m pip install -r requirements.txt
```
Make sure tests are passing
```bash
python3 -m unittest
```
and you locally run linter via
```bash
flake8 ./zahlwort2num/*.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
```
# WIKI
TBD
# Already implemented features :sunglasses:
* Theoretically it works for any numbers from range 0 upto 999 * 10^27 [big numbers]
* Command-line mode ([see](#command-line) above)
* Supported with ordinal numerals (incl. inflections [sufficies like `'ste', 'ten'` etc. ])
_In this case it returns coerced __String__ type value e.g '15.' instead of __Integer___ :point_up:
* Relative mild rules in terms of trailing whitespaces, lower/upper-case (unification).
* Handling of signed numerals (also ordinal ones) e.g `'minus zehn'`
# TODO / Known issues
- [x] ~~Make POC, functional for all common cases~~
- [x] ~~Ordinal number support~~
- [x] ~~Take care for exceptions / trailing whitespaces etc.~~
- [x] ~~Make structure + publish as PyPI package~~
- [x] ~~Command line support :computer:~~
- [x] ~~Added support for both non-direct usage e.g einhundert / hundert~~
- [x] ~~Simplify/refactor POC code, add better documentation~~
- [x] ~~Zwo variant~~
- [x] ~~Added linter with Test Suite as hook~~
- [ ] 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`)
- [ ] Support for fractions?
# Thanks
- @warichet for addressing problem
- @spatialbitz for writing simple fix :+1:
- @psawa - adding support for `zwo` case
- ... lastly to any of you who uses this package ;-)
%package -n python3-zahlwort2num
Summary: A small package for handy conversion of german numerals (also ordinal / signed) written as words to numbers.
Provides: python-zahlwort2num
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-zahlwort2num
# ZahlWort2num (v.0.4.2)
:de: :de: :de:
A small but useful (due shortage of/low quality support for `lang_de`) package for handy conversion of german numerals (incl. ordinal number) written as string to the from numbers.
To put it differently: _It allows reverse text normalization for numbers_.
This package might be a good complementary lib to https://github.com/savoirfairelinux/num2words
:crying_cat_face: _Currently is doesn't support swiss variant. TBD_ :switzerland:
# PyPi direct page of project
https://pypi.org/project/zahlwort2num/
# Installation
`pip2 install zahlwort2num`
# Usage
### _Definition_:
```python
import zahlwort2num as w2n
```
### _Few examples_:
```python
w2n.convert('Zweihundertfünfundzwanzig') # => 225
w2n.convert('neunte') # => '9.'
w2n.convert('minus siebenhundert Millionen achtundsiebzig') # => -700000078
```
_or even stuff like:_ :see_no_evil:
```python
w2n.convert('sechshundertdreiundfünfzigtausendfünfhunderteinundzwanzig') # => 653521
```
#### Command line:
* _(Obviously it is better to use a parameter enclosed with apostrophs due to possible spaces)_
```
bin/zahlwort2num-convert 'eine Million siebenhunderteinundzwanzig'
```
# Development
Before doing anything. Install flake8 locally by
```bash
python3 -m pip install -r requirements.txt
```
Make sure tests are passing
```bash
python3 -m unittest
```
and you locally run linter via
```bash
flake8 ./zahlwort2num/*.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
```
# WIKI
TBD
# Already implemented features :sunglasses:
* Theoretically it works for any numbers from range 0 upto 999 * 10^27 [big numbers]
* Command-line mode ([see](#command-line) above)
* Supported with ordinal numerals (incl. inflections [sufficies like `'ste', 'ten'` etc. ])
_In this case it returns coerced __String__ type value e.g '15.' instead of __Integer___ :point_up:
* Relative mild rules in terms of trailing whitespaces, lower/upper-case (unification).
* Handling of signed numerals (also ordinal ones) e.g `'minus zehn'`
# TODO / Known issues
- [x] ~~Make POC, functional for all common cases~~
- [x] ~~Ordinal number support~~
- [x] ~~Take care for exceptions / trailing whitespaces etc.~~
- [x] ~~Make structure + publish as PyPI package~~
- [x] ~~Command line support :computer:~~
- [x] ~~Added support for both non-direct usage e.g einhundert / hundert~~
- [x] ~~Simplify/refactor POC code, add better documentation~~
- [x] ~~Zwo variant~~
- [x] ~~Added linter with Test Suite as hook~~
- [ ] 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`)
- [ ] Support for fractions?
# Thanks
- @warichet for addressing problem
- @spatialbitz for writing simple fix :+1:
- @psawa - adding support for `zwo` case
- ... lastly to any of you who uses this package ;-)
%package help
Summary: Development documents and examples for zahlwort2num
Provides: python3-zahlwort2num-doc
%description help
# ZahlWort2num (v.0.4.2)
:de: :de: :de:
A small but useful (due shortage of/low quality support for `lang_de`) package for handy conversion of german numerals (incl. ordinal number) written as string to the from numbers.
To put it differently: _It allows reverse text normalization for numbers_.
This package might be a good complementary lib to https://github.com/savoirfairelinux/num2words
:crying_cat_face: _Currently is doesn't support swiss variant. TBD_ :switzerland:
# PyPi direct page of project
https://pypi.org/project/zahlwort2num/
# Installation
`pip2 install zahlwort2num`
# Usage
### _Definition_:
```python
import zahlwort2num as w2n
```
### _Few examples_:
```python
w2n.convert('Zweihundertfünfundzwanzig') # => 225
w2n.convert('neunte') # => '9.'
w2n.convert('minus siebenhundert Millionen achtundsiebzig') # => -700000078
```
_or even stuff like:_ :see_no_evil:
```python
w2n.convert('sechshundertdreiundfünfzigtausendfünfhunderteinundzwanzig') # => 653521
```
#### Command line:
* _(Obviously it is better to use a parameter enclosed with apostrophs due to possible spaces)_
```
bin/zahlwort2num-convert 'eine Million siebenhunderteinundzwanzig'
```
# Development
Before doing anything. Install flake8 locally by
```bash
python3 -m pip install -r requirements.txt
```
Make sure tests are passing
```bash
python3 -m unittest
```
and you locally run linter via
```bash
flake8 ./zahlwort2num/*.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
```
# WIKI
TBD
# Already implemented features :sunglasses:
* Theoretically it works for any numbers from range 0 upto 999 * 10^27 [big numbers]
* Command-line mode ([see](#command-line) above)
* Supported with ordinal numerals (incl. inflections [sufficies like `'ste', 'ten'` etc. ])
_In this case it returns coerced __String__ type value e.g '15.' instead of __Integer___ :point_up:
* Relative mild rules in terms of trailing whitespaces, lower/upper-case (unification).
* Handling of signed numerals (also ordinal ones) e.g `'minus zehn'`
# TODO / Known issues
- [x] ~~Make POC, functional for all common cases~~
- [x] ~~Ordinal number support~~
- [x] ~~Take care for exceptions / trailing whitespaces etc.~~
- [x] ~~Make structure + publish as PyPI package~~
- [x] ~~Command line support :computer:~~
- [x] ~~Added support for both non-direct usage e.g einhundert / hundert~~
- [x] ~~Simplify/refactor POC code, add better documentation~~
- [x] ~~Zwo variant~~
- [x] ~~Added linter with Test Suite as hook~~
- [ ] 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`)
- [ ] Support for fractions?
# Thanks
- @warichet for addressing problem
- @spatialbitz for writing simple fix :+1:
- @psawa - adding support for `zwo` case
- ... lastly to any of you who uses this package ;-)
%prep
%autosetup -n zahlwort2num-0.4.2
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-zahlwort2num -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue Jun 20 2023 Python_Bot - 0.4.2-1
- Package Spec generated