cedict 0.2.2

Parser for the CC-CEDICT Chinese-English Dictionary
docs.rs failed to build cedict-0.2.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: cedict-0.3.1

cedict - Rust library for parsing CC-CEDICT

Crates.io Docs.rs

cedict is a Rust crate for reading and writing the CC-CEDICT Chinese-English dictionary format. It can be used to implement Chinese dictionaries in Rust. It can also serve as a tool for automating maintenance to the CEDICT project.

What is CC-CEDICT

CC-CEDICT, or formerly CEDICT, is a freely available Chinese-English dictionary. This library allows you to parse it.

Usage

let line = "你好 你好 [ni3 hao3] /Hello!/Hi!/How are you?/";
let parsed = cedict::parse_line(line).unwrap();

println!("{}", parsed.definitions[0]); // Prints "Hello!"

Parse a dictionary file and search for "Hello".

extern crate cedict;

use std::fs::File;

fn main() {
    let file = File::open("cedict.txt").unwrap();

    for definition in cedict::parse_reader(file) {
        if definition.definitions().next().unwrap().contains("Hello") {
            println!("{}", definition.simplified());
        }
    }
}