6 releases

0.1.5 Dec 22, 2024
0.1.4 Oct 27, 2024
0.1.3 Sep 17, 2024
0.1.1 Jan 25, 2024
0.1.0 Nov 26, 2023

#421 in Text processing

Download history 200/week @ 2024-09-13 54/week @ 2024-09-20 17/week @ 2024-09-27 3/week @ 2024-10-04 1/week @ 2024-10-11 111/week @ 2024-10-25 30/week @ 2024-11-01 6/week @ 2024-11-08 2/week @ 2024-11-15 4/week @ 2024-12-06 1/week @ 2024-12-13 115/week @ 2024-12-20 9/week @ 2024-12-27

129 downloads per month
Used in xuexi

MIT/Apache

40KB
783 lines

Nomnom 🥘 吃吃

Nado - CLI

Just a small util tool to convert the cedict_ts.u8 into a JSON or CSV file. Additionals features are:

  • Add pinyin with accent based on these rules
  • Add HSK level character based fetched on mandarinbean. The HSK7-9 level is parsed from a different website by wohok
  • Add zhuyin support based on this conversion rules link
  • Add wade-giles support based on this conversion rules link

Usage

Clone this project and run one of the cargo command below. If needed I could provided the generate json & csv file.

Json

cargo run -- generate -e ../cedict_ts.u8 -o ../cedict.json -f json

Csv

cargo run -- generate -e ../cedict_ts.u8 -o ../cedict.csv -f csv

Dodo - Lib

A small crate which allows to do several operations on the cedict.u8 file but also allows you to do some operations on chinese characters such as:

  • Convert pinyin tones to pinyin numbers and vice versa
  • Convert pinyin to wade-giles
  • Convert pinyin to zhuyin
  • Convert a simplified chinese text to tradional and vice versa
  • Detect which chinese variant a text is written
use dodo_zh;
use dodo_zh::variant::KeyVariant;

fn main() {
    // The KeyVariant can either be Traditional or Simplified chinese
    let cedict = dodo_zh::load_cedict_dictionary(path, KeyVariant::Traditional).unwrap();
    let wo = cedict.items.get("").unwrap();

    // will return an Item struct
    println!(wo.translations);
}

A set of example exist which can helps you to see how to do some pinyin manipulation. Namely convert the pinyin with tone number to a pinyin with tone marker etc...

You can run the example with the following command

cargo run --example dodo

Dependencies

~1.6–2.6MB
~69K SLoC