Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Python script to color Chinese syllables by their tones.

License

NotificationsYou must be signed in to change notification settings

travisgk/colortones

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Python script that colors Chinese characters to match their spoken tone.This tool provides other transcriptions into zhuyin, pinyin, and the IPA as well.


Setup

pip install pypinyin jieba

Example

import colortones# processes the text.chinese = "老板想买哪种水果?我听不懂。不要打扰我。"paragraph = colortones.process_text(chinese)# loads a color scheme.scheme = colortones.load_color_scheme("default")# prints colored text to the console.print(paragraph.to_color_str("hanzi", color_scheme=scheme))print(paragraph.to_color_str("pinyin", color_scheme=scheme))print(paragraph.to_color_str("ipa-root", color_scheme=scheme))print(paragraph.to_color_str("zhuyin-root", color_scheme=scheme))

[8]ページ先頭

©2009-2025 Movatter.jp