Skip to content

Chinese character variant converter

License

Notifications You must be signed in to change notification settings

cbdb-project/CHAR

 
 

Repository files navigation

Image

Chinese Character Variant Converter,

an open-source library for converting Chinese character variants to standard simplified or traditional characters.

* About the project's 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).

Online Demo

Char Converter Demo

Python

Install

pip install char-converter

Usage

Convert text

  1. Mode: one2one
from char_converter import CharConverter

text = '苟馀情其訫姱㠯练要兮,镸顑頷亦何伤。'

converter = CharConverter('v2t')
converted_text = converter.convert(text)
# 苟餘情其信姱以練要兮,長顑頷亦何傷。

converter = CharConverter('v2s')
converted_text = converter.convert(text)
# 苟余情其信姱以练要兮,长顑颔亦何伤。
  1. 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

CBDB Project

OpenCC image

Dictionary of Variant Chinese Characters

General Standard Chinese Characters Table

Data filtering

Image

Contributors

Yuqi Chen (data collection and programming)

Hongsu Wang (project manager)

Yiyi Wang (proofreading)

Fengyi Ji (data collection)

Kaini Xiong (proofreading)

License

License: CC BY-SA 4.0

About

Chinese character variant converter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 40.4%
  • Jupyter Notebook 22.5%
  • HTML 19.1%
  • JavaScript 18.0%