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.1.tar.gz (84.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: zhon-2.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 436773a7ee38efafefa8abaf78fd15bf6df94663ad3e862372adfa16e26824db
MD5 5b9498a0779f6b16babfea0f4040d00c
BLAKE2b-256 1be8f598843392c06d1184f97600475681094fed116062e627045a9b7ec3a25a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zhon-2.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f1c5e94a7c706beb4b01dff67b7b137ee016dd219a454cf840f5ade49c011e2
MD5 09eb7d7ffdd0d6279b5c6754f121e4dd
BLAKE2b-256 193008c800b21ea192459a43d750b3e35f042322d8233d789c4fb87923effafe

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