Crate dodo_zh

Crate dodo_zh 

Source
Expand description

Dodo-zh is a crate which provide utilities method on pinyin and cedict file. It enables you to do the following operations

  • Load cedict file from a given path with the keys either being in Simplified or Traditional Chinese

Doing several operations on a given pinyin such as:

  • convert a pinyin to a zhuyin
  • convert a pinyin to a wade giles
  • convert a pinyin which has number tones e.g: wo3 to a pinyin with tone markers wǒ
  • convert a pinyin with tones markers to numbers
  • convert a simplified <-> traditional text
  • detect chinese variant of a text

Modules§

cedict
variant

Functions§

convert_pinyin_accent_to_pinyin_number
Convert a sequence of pinyin with accent into a pinyin with number
convert_pinyin_to_wade_giles
Convert a sequence of pinyin into wade giles
convert_pinyin_to_zhuyin
Convert a sequence of pinyin with tone markers into zhuyin
convert_pinyin_tone_number_to_tone_mark
Convert a sequence of pinyin with number to a pinyin tone mark
convert_text_to_desired_variant
Convert a chinese text to a desired variant (simplified <-> tradtional)
detect_which_variant
Detect which variant of chinese is the text. If the given path for the cedict dictionary is passed the detection will use the cedict. Otherwise it’ll try to do the detection through unicode. ⚠️ Unicode detection isn’t very accurate. It’s recommended to use the cedict dictionary for a precise detection.
load_cedict_dictionary
Load Cedict Dictionary