Skip to content

Korean-Hanja(Chinese character for Korean language) dictionary for Rust

Notifications You must be signed in to change notification settings

bekker/hanja-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hanja-rs

Build Status

Korean-Hanja(Chinese character for Korean language) dictionary for Rust.

You can lookup Hanja for a given Hangeul syllable, like most of Korean IMEs do.

All Hanja entries are sorted by the use frequency of each.

Only syllables supported, not words(Hanjaeo).

Hashmap is precompiled fast using phf, taking only a few seconds.

Hanja dictionary and frequency data credited to libhangul and its contributors.

[dependencies]
hanja = "0.1.1"

Usage

extern crate hanja;

fn main() {
    for &(hanja, desc) in hanja::get('화').unwrap().iter().take(10) {
        println!("{}: {}", hanja, desc);
    }

    let korea_in_hangeul = "대한민국";
    let korea_in_hanja = korea_in_hangeul.chars()
            .map(|c| hanja::get(c).unwrap()[0].0)
            .collect::<String>();
    println!("{}", korea_in_hanja); // 大韓民國
}
火: 불 화
花: 꽃 화
化: 될 화
話: 말할 화, 이야기 화
和: 화할 화
畵: 그림 화
華: 꽃 화, 빛날 화
貨: 재화 화, 재물 화
禍: 재화 화
禾: 벼 화
大韓民國

Documentation

Docs.rs

License

Distributed under MIT License

About

Korean-Hanja(Chinese character for Korean language) dictionary for Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages