Skip to main content

Hanzi Converter for Traditional and Simplified Chinese

Project description

Hanzi Converter 繁簡轉換器 | 繁简转换器
This tool converts between simplified and traditional Chinese Characters.
It consists of two parts:

- a command line tool: ``hanzi-convert``
- a python library: ``hanziconv``

.. image::
:alt: Build Status

.. image::
:alt: Latest Version

.. image::
:alt: Documentation

.. image::
:alt: Source Code

.. image::
:alt: License


.. code-block:: sh

$ pip install hanziconv


.. code-block:: sh

$ [sudo] pip uninstall hanziconv

Command Line Tool


.. code-block:: sh

$ ./hanzi-convert --help
usage: hanzi-convert [-h] [-o OUTFILE] [-s] [-v] infile

Simplified and Traditional Chinese Character Conversion
Version 0.3.1 (By Bernard Yue)

Converting to Traditional Hanzi by default with no -s flag

positional arguments:
infile filename | "-", corresponds to stdin

optional arguments:
-h, --help show this help message and exit
-o OUTFILE, --output OUTFILE
filename to save output, stdout if omitted
-s, --simplified convert to simplified characters
-v, --version show program's version number and exit


Conversion from stdin

.. code-block:: sh

$ ./hanzi-convert -
Press Crtl-D when finished
Typing away
Now write some chinese characters
Typing away
Now write some chinese characters

Python API


.. code-block:: pycon

>>> from hanziconv import HanziConv
>>> print(HanziConv.toSimplified('繁簡轉換器'))
>>> print(HanziConv.toTraditional('繁简转换器'))
>>> HanziConv.same('繁簡轉換器', '繁简转换器')

The module uses `pytest <>`_. Use pip to install `pytest`.

.. code-block:: sh

$ [sudo] pip install pytest

Then checkout source code and run test as normal.

.. code-block:: sh

$ git clone
$ cd hanziconv
$ python test

You are encouraged to use `virtualenv <>`_
and `virtualenvwrapper <>`_
for to avoid changing your currently operating environment.

| This module is distributed under Apache License Version 2.0.
The character map used in this module is based on the Multi-function
Chinese Character Database developed by Chinese University of Hong Kong.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hanziconv-0.3.1.tar.gz (196.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page