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
This module supports both Python 2 and 3
Installation
$ pip install hanziconv
Uninstallation
$ [sudo] pip uninstall hanziconv
Command Line Tool
Synopsis
$ ./hanzi-convert --help
usage: hanzi-convert [-h] [-o OUTFILE] [-s] [-v] infile
Simplified and Traditional Chinese Character Conversion
Version 0.3.2 (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
Example
Conversion from stdin
$ ./hanzi-convert -
Press Crtl-D when finished
Typing away
Now write some chinese characters
繁简转换器
^D
Typing away
Now write some chinese characters
繁簡轉換器
$
Python API
Example
>>> from hanziconv import HanziConv
>>> print(HanziConv.toSimplified('繁簡轉換器'))
繁简转换器
>>> print(HanziConv.toTraditional('繁简转换器'))
繁簡轉換器
>>> HanziConv.same('繁簡轉換器', '繁简转换器')
True
Testing
The module uses pytest. Use pip to install pytest.
$ [sudo] pip install pytest
Then checkout source code and run test as normal.
$ git clone https://github.com/berniey/hanziconv
$ cd hanziconv
$ python setup.py test
You are encouraged to use virtualenv and virtualenvwrapper for to avoid changing your currently operating environment.
License
The character map used in this module is based on the Multi-function Chinese Character Database developed by Chinese University of Hong Kong.
Metadata
Release files for hanziconv 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hanziconv-0.3.2.tar.gz | 276.8 kB | Without provenance | Details for hanziconv-0.3.2.tar.gz |
Release files / hanziconv-0.3.2.tar.gz
| Download URL | hanziconv-0.3.2.tar.gz |
|---|---|
| Size | 276.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
208866da6ae305bca19eb98702b65c93bb3a803b496e4287ca740d68892fc4c4
|
|
BLAKE2b-256 checksum How to use checksums |
6371b89cb63077fd807fe31cf7c016a06e7e579a289d8a37aa24a30282d02dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for hanziconv 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.