This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

search for chinese pinyin and wrap it with HTML.

colorize pinyin

search for chinese pinyin and wrap it with HTML.

module provides some useful functions for working with Chinese pinyin, “phonetic system for transcribing the Mandarin pronunciations of Chinese characters into the Latin alphabet” (c) wikipedia .

usage sample

>>> colorized_HTML_string_from_string('nǐ hǎo')
'<span class="pinYinWrapper"><span class="t3">nǐ</span> <span class="t3">hǎo</span></span>'
>>> ranges_of_pinyin_in_string('nǐ hǎo')
[Range(location=0, length=2), Range(location=3, length=3)]  # == [(0, 2), (3, 3)]


lxml is only required if you want to work with DOM. but it does not listed in requirements because if you want to use them, surely you already have lxml on the board; for other cases we don’t need additional third-party libs.

functions that designed to work with lxml marked with [*].


modify given DOM by replacing children text nodes containing pinyin with wrapper element:

colorize_DOM [*]

undo colorize:

uncolorize_DOM [*]

detect and wrap pinyin with HTML in plain text string:


do the same, but returns a wrapper – DOM element:

colorized_HTML_element_from_string [*]

searching for pinyin in string of text:


finding out what tone has some pinyin word:


remove tones (diacritics) from pinyin string:



PINYIN_LIST – specially sorted list of all possible pinyin words.

PINYIN_LIST_BY_LEN – same as PINYIN_LIST but grouped by len descending.

PINYIN_WRAPPER_CLASS – default class used by [un]colorize_DOM.


Range – 2-named-tuple with [0] location and [1] length.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
colorize_pinyin-2.1.1.macosx-10.8-x86_64.tar.gz (11.5 kB) Copy SHA256 Checksum SHA256 Source Jan 24, 2016
colorize_pinyin-2.1.1-py2-none-any.whl (11.2 kB) Copy SHA256 Checksum SHA256 py2 Wheel Jan 24, 2016
colorize_pinyin-2.1.1-py3-none-any.whl (11.2 kB) Copy SHA256 Checksum SHA256 py3 Wheel Jan 24, 2016
colorize_pinyin-2.1.1.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Jan 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting