Convert numbers from/to Japanese Numbers
Project description
jp_numbers.
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(number=87654, as_str='87654', as_kanji='八万七千六百五十四')
In [4]: jn.number2kanji(87654, style='arabic')
Out[4]: JpNumber(number=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(number=87654, as_str='87654', as_kanji='8万7654')
In [6]: jn.number2kanji(87654, style='finance')
Out[6]: JpNumber(number=87654, as_str='87654', as_kanji='87,654')
In [7]: jn.number2kanji(87654, style='daiji')
Out[7]: JpNumber(number=87654, as_str='87654', as_kanji='捌萬漆仟陸佰伍拾肆')
In [8]: jn.kanji2number('八万七千六百五十四')
Out[8]: JpNumber(number=87654, as_str='87654', as_kanji='八万七千六百五十四')
In [9]: jn.kanji2number('87654')
Out[9]: JpNumber(number=87654, as_str='87654', as_kanji='87654')
In [10]: jn.kanji2number('87,654')
Out[10]: JpNumber(number=87654, as_str='87654', as_kanji='87,654')
In [11]: jn.kanji2number('捌萬漆仟陸佰伍拾肆')
Out[11]: JpNumber(number=87654, as_str='87654', as_kanji='捌萬漆仟陸佰伍拾肆')
In [12]: jn.kanji2number('天神四丁目')
Out[12]: JpNumber(number=4, as_str='4', as_kanji='天神四丁目')
In [13]: jn.kanji2number('天神4丁目')
Out[13]: JpNumber(number=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.0.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for jp_number-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af22d97b6fc52fb61fad157eb138871115824605e2298207f4cbcc1b6b942147 |
|
MD5 | ed7ce77314d980a473640b2796ce821c |
|
BLAKE2b-256 | 6477a8630fdd5e0bcf83a1453202ddc79d4bf0e0e7f2f5aa0930add4a183766c |