Skip to main content

Zhon provides constants used in Chinese text processing.

Project description

https://badge.fury.io/py/zhon.svg https://github.com/tsroten/zhon/actions/workflows/ci.yml/badge.svg

Zhon is a Python library that provides constants commonly used in Chinese text processing.

About

Zhon’s constants can be used in Chinese text processing, for example:

  • Find CJK characters in a string:

    >>> re.findall('[{}]'.format(zhon.hanzi.characters), 'I broke a plate: 我打破了一个盘子.')
    ['我', '打', '破', '了', '一', '个', '盘', '子']
  • Validate Pinyin syllables, words, or sentences:

    >>> re.findall(zhon.pinyin.syllable, 'Yuànzi lǐ tíngzhe yí liàng chē.', re.I)
    ['Yuàn', 'zi', 'lǐ', 'tíng', 'zhe', 'yí', 'liàng', 'chē']
    
    >>> re.findall(zhon.pinyin.word, 'Yuànzi lǐ tíngzhe yí liàng chē.', re.I)
    ['Yuànzi', 'lǐ', 'tíngzhe', 'yí', 'liàng', 'chē']
    
    >>> re.findall(zhon.pinyin.sentence, 'Yuànzi lǐ tíngzhe yí liàng chē.', re.I)
    ['Yuànzi lǐ tíngzhe yí liàng chē.']

Features

  • Includes commonly-used constants:
    • CJK characters and radicals

    • Chinese punctuation marks

    • Chinese sentence regular expression pattern

    • Pinyin vowels, consonants, lowercase, uppercase, and punctuation

    • Pinyin syllable, word, and sentence regular expression patterns

    • Zhuyin characters and marks

    • Zhuyin syllable regular expression pattern

    • CC-CEDICT characters

Getting Started

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

zhon-2.0.0.tar.gz (84.5 kB view details)

Uploaded Source

Built Distribution

zhon-2.0.0-py3-none-any.whl (84.0 kB view details)

Uploaded Python 3

File details

Details for the file zhon-2.0.0.tar.gz.

File metadata

  • Download URL: zhon-2.0.0.tar.gz
  • Upload date:
  • Size: 84.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for zhon-2.0.0.tar.gz
Algorithm Hash digest
SHA256 766cf66d1e6a3b6efe43790fada0cc0c428e6d4bc0e3b28b66a07fe8175050a6
MD5 abc4afcfb8965cdb10f7a2f25f4da00a
BLAKE2b-256 495d7f62f5bceb27b0e7e864aa8b990b0b3c451120052e6910af5937d3b0b1ee

See more details on using hashes here.

File details

Details for the file zhon-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: zhon-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 84.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for zhon-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3e12593ebeab2f77b9f4bbe32f920bc684dafa840bccbf47fe95bb7059b6b44
MD5 8b545ce631718287c43760e145c2318e
BLAKE2b-256 91cfa9fced50fbe70022692a05341a981054b918730a9a7ce808b93ccd123f5f

See more details on using hashes here.

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