A library to convert variant Chinese characters to standard simplified or traditional characters.
Project description
Chinese Character Variant Converter,
an open-source library for converting Chinese character variants to standard simplified or traditional characters.
*If you're curious about our name and logo: 'CHAR' comes from 'Chinese character variant' and also refers to a type of beautiful fish with a gradient of red color (Arctic Char).
Install
pip install char-converter
Usage
Convert text
- Mode: one2one
from char_converter import CharConverter
text = '苟馀情其訫姱㠯练要兮,镸顑頷亦何伤。'
converter = CharConverter('v2t')
converted_text = converter.convert(text)
# 苟餘情其信姱以練要兮,長顑頷亦何傷。
converter = CharConverter('v2s')
converted_text = converter.convert(text)
# 苟余情其信姱以练要兮,长顑颔亦何伤。
- Mode: one2many
from char_converter import CharConverter
text = '鈡𩄇毓秀'
converter = CharConverter('v2t')
converter.set_mode('one2many')
converted_text = converter.convert(text)
# 【鍾|鐘】靈毓秀
Convert file
from char_converter import CharConverter
converter = CharConverter('v2s')
converter.convert_file(input_file, output_file)
Data source
Dictionary of Variant Chinese Characters
General Standard Chinese Characters Table
Data filtering
Contributors
Yuqi Chen (data collection and programming)
Hongsu Wang (project manager)
Yiyi Wang (proofreading), Fengyi Ji (data collection)
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
Built Distribution
File details
Details for the file char_converter-0.37.tar.gz
.
File metadata
- Download URL: char_converter-0.37.tar.gz
- Upload date:
- Size: 84.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c05bf36bcceb3b2b5878d2f460ef9fd392032cbcadd23968bc514335587d729c |
|
MD5 | 9326a8420e9e25aa9360940d5647ce6b |
|
BLAKE2b-256 | f2652f89267c50535f20b685884363fceff2cd22a0f7b019610c8798c8bc754b |
File details
Details for the file char_converter-0.37-py3-none-any.whl
.
File metadata
- Download URL: char_converter-0.37-py3-none-any.whl
- Upload date:
- Size: 81.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbdff95ef4d9bf6ef1133495d80d5b302b078c147dca7d881e385df0d1720276 |
|
MD5 | ea4560d667d169bdd99eb686c0ea5043 |
|
BLAKE2b-256 | c63aa9ba514fd0391994f18807dd9168a3c40f6099316d7b30aed0c7765c4460 |