Skip to main content

Convert between Chinese Telegraph Codes and Unicode Chinese characters.

Project description

zhtelecode

zhtelecode is a Python package that converts between Chinese Telegraph Codes and Unicode Chinese characters (both simplified and traditional).

Usage

Convert from Unicode to telegraph codes:

>>> zhtelecode.to_telecode("中文信息")
['0022', '2429', '0207', '1873']

>>> zhtelecode.to_telecode("萧爱国")
['5618', '1947', '0948']

>>> zhtelecode.to_telecode("蕭愛國")
['5618', '1947', '0948']

Convert from telegraph codes back to Unicode:

>>> telecode = ["0022", "2429", "0207", "1873"]
>>> zhtelecode.to_unicode(telecode)
'中文信息'

>>> telecode = ["5618", "1947", "0948"]
>>> zhtelecode.to_unicode(telecode, encoding="mainland")
'萧爱国'

>>> zhtelecode.to_unicode(telecode, encoding="taiwan")
'蕭愛國'

Data

The codebooks are derived from the Unicode consortium's Unihan database (last updated 2022-08-03 17:20).

License

MIT License.

Also see Unicode terms of use.

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

zhtelecode-0.1.0.tar.gz (38.0 kB view details)

Uploaded Source

File details

Details for the file zhtelecode-0.1.0.tar.gz.

File metadata

  • Download URL: zhtelecode-0.1.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for zhtelecode-0.1.0.tar.gz
Algorithm Hash digest
SHA256 78fbe20975bb3a5803866fdf2b1996cdaa1baacfd3aaeb9a5ac561cb0f6336df
MD5 8a78d734c6bb3084f27b73928e36ce22
BLAKE2b-256 17c8d53c73a0c9dfb09d2f677a3cb1b782730b6c7107dbdd7b54fe9c07a4a760

See more details on using hashes here.

Supported by

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