A fast converter between Japanese hankaku and zenkaku characters
Project description
A fast converter between Japanese hankaku and zenkaku characters.
Installation
$ pip install mojimoji
Examples
Zenkaku to Hankaku
>>> import mojimoji
>>> print mojimoji.zen_to_han(u'アイウabc012')
アイウabc012
>>> print mojimoji.zen_to_han(u'アイウabc012', kana=False)
アイウabc012
>>> print mojimoji.zen_to_han(u'アイウabc012', digit=False)
アイウabc012
>>> print mojimoji.zen_to_han(u'アイウabc012', ascii=False)
アイウabc012
Hankaku to Zenkaku
>>> import mojimoji
>>> print mojimoji.han_to_zen(u'アイウabc012')
アイウabc012
>>> print mojimoji.han_to_zen(u'アイウabc012', kana=False)
アイウabc012
>>> print mojimoji.han_to_zen(u'アイウabc012', digit=False)
アイウabc012
>>> print mojimoji.han_to_zen(u'アイウabc012', ascii=False)
アイウabc012
Benchmarks
Library versions
mojimoji: 0.0.1
zenhan: 0.4
unicodedata: Bundled with Python 2.7.3
Results
In [19]: s = u'ABCDEFG012345' * 10
In [20]: %time for n in range(1000000): mojimoji.zen_to_han(s)
CPU times: user 2.86 s, sys: 0.10 s, total: 2.97 s
Wall time: 2.88 s
In [21]: %time for n in range(1000000): unicodedata.normalize('NFKC', s)
CPU times: user 5.43 s, sys: 0.12 s, total: 5.55 s
Wall time: 5.44 s
In [22]: %time for n in range(1000000): zenhan.z2h(s)
CPU times: user 69.18 s, sys: 0.11 s, total: 69.29 s
Wall time: 69.48 s
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
mojimoji-0.0.10.dev0.tar.gz
(42.6 kB
view details)
Built Distributions
File details
Details for the file mojimoji-0.0.10.dev0.tar.gz
.
File metadata
- Download URL: mojimoji-0.0.10.dev0.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a93d18af322074ec61028349679b0057de0355a17af346a70ff89814adecfef9 |
|
MD5 | 467752f745b6c7d007202fbc0fe2b45a |
|
BLAKE2b-256 | 95a1a22751e48139d1a12d7e64995ca99807448b48c988a654fb9bf4895e929f |
File details
Details for the file mojimoji-0.0.10.dev0-cp38-cp38-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mojimoji-0.0.10.dev0-cp38-cp38-macosx_10_13_x86_64.whl
- Upload date:
- Size: 41.7 kB
- Tags: CPython 3.8, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c313fbe855c6b35705ebe8097369db06c683358a140f5f463476bf2f4e8206aa |
|
MD5 | b6275d8967969f31dd2dd2a013d0b770 |
|
BLAKE2b-256 | f3fd57d1929990f9169adb02edbbea3500c72af8f09b39e8cc5508216b951557 |
File details
Details for the file mojimoji-0.0.10.dev0-cp37-cp37m-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mojimoji-0.0.10.dev0-cp37-cp37m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 41.2 kB
- Tags: CPython 3.7m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3055525642a4794e47a881551b022ec2e4347fe6d26c8c66698282c72dce79e0 |
|
MD5 | 31d01fbb028260440e8400597891436e |
|
BLAKE2b-256 | 454b2a985f77c3483986f5aab746aa2c2bd8078e8c7e88375942b29ec7386a10 |
File details
Details for the file mojimoji-0.0.10.dev0-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: mojimoji-0.0.10.dev0-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 126.3 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1573438831a5052030f8450f400c00a97c43c42b60d3d22a98f4f7597029aea |
|
MD5 | e140cf2f96dfad2c1f34c4d54f0497fc |
|
BLAKE2b-256 | 4aca02acd77a537a2e33f0b678b109416b61aeaa34ffd172f2a77fbcef3d1267 |
File details
Details for the file mojimoji-0.0.10.dev0-cp35-cp35m-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mojimoji-0.0.10.dev0-cp35-cp35m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 38.1 kB
- Tags: CPython 3.5m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.5.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb7b430158fca9b0cec2c654cd0af58ff469d420e4c34095bd09a2a88ec82ea9 |
|
MD5 | f31ec6c4a96790b01c46bd13b287c818 |
|
BLAKE2b-256 | 0be007ff4b2d88d320cac4fae89f404a3ce07c538b54f34fcb5bcbec893b0437 |