Crate opencc [] [src]

OpenCC binding for Rust

You should install OpenCC 1.0.x library first.

Supported configurations:

  • s2t.json Simplified Chinese to Traditional Chinese
  • t2s.json Traditional Chinese to Simplified Chinese
  • s2tw.json Simplified Chinese to Traditional Chinese (Taiwan Standard)
  • tw2s.json Traditional Chinese (Taiwan Standard) to Simplified Chinese
  • s2hk.json Simplified Chinese to Traditional Chinese (Hong Kong Standard)
  • hk2s.json Traditional Chinese (Hong Kong Standard) to Simplified Chinese
  • s2twp.json Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom
  • tw2sp.json Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiom
  • t2tw.json Traditional Chinese (OpenCC Standard) to Taiwan Standard
  • t2hk.json Traditional Chinese (OpenCC Standard) to Hong Kong Standard

Examples

extern crate opencc;

use opencc::OpenCC;

fn main() {
    let cc = OpenCC::new("t2s.json");
    println!("{}", cc.convert("乾坤一擲"));
    println!("{}", cc.convert("開放中文轉換"));
}

Structs

OpenCC