Convert numbers from/to Japanese Numbers
Project description
jp_number
Convert numbers from/to Japanese Numbers This is spin-off project from jp_prefecture
Install
pip install jp_number
How to use
from jp_number import JpNumberParser
jn = JpNumberParser()
class JpNunberPaser
kanji2number(val)
number2kanji(val, style)
- style: 'kanji', 'arabic', 'mix', 'finance', 'daiji'
normalize_kanjinumber(val)
In [1]: from jp_number import JpNumberParser
In [2]: jn = JpNumberParser()
In [3]: jn.number2kanji(87654)
Out[3]: JpNumber(as_int=87654, as_str='87654', as_kanji='八万七千六百五十四')
In [4]: jn.number2kanji(87654, style='arabic')
Out[4]: JpNumber(as_int=87654, as_str='87654', as_kanji='87654')
In [5]: jn.number2kanji(87654, style='mix')
09:44:27.69 LOG:
09:44:27.78 .... count = 0
Out[5]: JpNumber(as_int=87654, as_str='87654', as_kanji='8万7654')
In [6]: jn.number2kanji(87654, style='finance')
Out[6]: JpNumber(as_int=87654, as_str='87654', as_kanji='87,654')
In [7]: jn.number2kanji(87654, style='daiji')
Out[7]: JpNumber(as_int=87654, as_str='87654', as_kanji='捌萬漆仟陸佰伍拾肆')
In [8]: jn.kanji2number('八万七千六百五十四')
Out[8]: JpNumber(as_int=87654, as_str='87654', as_kanji='八万七千六百五十四')
In [9]: jn.kanji2number('87654')
Out[9]: JpNumber(as_int=87654, as_str='87654', as_kanji='87654')
In [10]: jn.kanji2number('87,654')
Out[10]: JpNumber(as_int=87654, as_str='87654', as_kanji='87,654')
In [11]: jn.kanji2number('捌萬漆仟陸佰伍拾肆')
Out[11]: JpNumber(as_int=87654, as_str='87654', as_kanji='捌萬漆仟陸佰伍拾肆')
In [12]: jn.kanji2number('天神四丁目')
Out[12]: JpNumber(as_int=4, as_str='4', as_kanji='天神四丁目')
In [13]: jn.kanji2number('天神4丁目')
Out[13]: JpNumber(as_int=4, as_str='4', as_kanji='天神4丁目')
In [14]: jn.normalize_kanjinumber('京都府長岡京市天神2丁目15-13')
Out[14]: '京都府長岡京市天神二丁目十五-十三'
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
jp_number-0.1.1.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file jp_number-0.1.1.tar.gz
.
File metadata
- Download URL: jp_number-0.1.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1337ee6ba24bffd430f747483cb6a875db77be2dbdd54e5d869d8623ee75c94b |
|
MD5 | 98a89c7a31e0bce36bc85448ed4773b3 |
|
BLAKE2b-256 | d55ecb16d437655cd9aeb77c791e9d36b9c9d84c131f1709687d7300f31c7074 |
File details
Details for the file jp_number-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: jp_number-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9a1808027fd786ed56014aed8bcf82d1034ef3e6d00a17e6e8109ddfd28c301 |
|
MD5 | e92b254e3c84281b8e972296e3ab29d5 |
|
BLAKE2b-256 | 8548cbd4c393623a5602a6d6ef602d76f2f21aa1dff01de421322c9b5a09a9a4 |