Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description-Content-Type: UNKNOWN
Description: mojimoji
========
.. image:: https://badge.fury.io/py/mojimoji.png
:target: http://badge.fury.io/py/mojimoji
.. image:: https://travis-ci.org/studio-ousia/mojimoji.png?branch=master
:target: https://travis-ci.org/studio-ousia/mojimoji
A lightweight converter between hankaku(half-width) and zenkaku(full-width) characters.
Installation
------------
.. code-block:: bash
$ pip install mojimoji
Examples
--------
Zenkaku to Hankaku
^^^^^^^^^^^^^^^^^^
.. code-block:: python
>>> 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
^^^^^^^^^^^^^^^^^^
.. code-block:: python
>>> 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 <https://pypi.python.org/pypi/zenhan>`_: 0.4
- `unicodedata <http://docs.python.org/2/library/unicodedata.html>`_: Bundled with Python 2.7.3
Results
^^^^^^^
.. code-block:: python
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
Keywords: japanese
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: Japanese
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description-Content-Type: UNKNOWN
Description: mojimoji
========
.. image:: https://badge.fury.io/py/mojimoji.png
:target: http://badge.fury.io/py/mojimoji
.. image:: https://travis-ci.org/studio-ousia/mojimoji.png?branch=master
:target: https://travis-ci.org/studio-ousia/mojimoji
A lightweight converter between hankaku(half-width) and zenkaku(full-width) characters.
Installation
------------
.. code-block:: bash
$ pip install mojimoji
Examples
--------
Zenkaku to Hankaku
^^^^^^^^^^^^^^^^^^
.. code-block:: python
>>> 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
^^^^^^^^^^^^^^^^^^
.. code-block:: python
>>> 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 <https://pypi.python.org/pypi/zenhan>`_: 0.4
- `unicodedata <http://docs.python.org/2/library/unicodedata.html>`_: Bundled with Python 2.7.3
Results
^^^^^^^
.. code-block:: python
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
Keywords: japanese
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: Japanese
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Release files for mojimoji 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mojimoji-0.0.8.tar.gz | 39.9 kB | Details |
Release files / mojimoji-0.0.8.tar.gz
| Download URL | mojimoji-0.0.8.tar.gz |
|---|---|
| Size | 39.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acab355a3d1818dde0ca0f3193acdc43e409877696830fbcee45b9b203d451fa
|
|
BLAKE2b-256 checksum How to use checksums |
6eddb2fde54ecfd7f66e5a39ca0fd6245480af62e0d91dbe9d6a5d4551196e67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |