Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

okpyeon (옥편)

crates.io docs.rs

한국어 입력기의 한자 키가 필요로 하는 두 가지 정적 후보 데이터: 독음 → 한자 후보(훈음 포함), 그리고 MS IME 식 자음 → 특수문자 표 ( + 한자 → ※ ☆ ★ …).

Static candidate data for Korean IMEs, covering both things the 한자(hanja) key does: hanja lookup (a hangul syllable reading to hanja candidates with hun-eum glosses, like a paper 옥편) and the MS-IME-style special symbol tables (compose a lone consonant, press the hanja key, pick a symbol). Single-char lookups only; word-level conversion is deliberately out of scope. No allocation, no_std, zero dependencies.

Usage

// 독음 → 한자 후보 (훈음 포함, 상용 한자 우선 순서)
let candidates = okpyeon::hanja('학').unwrap();
assert_eq!(candidates[0], ('學', "배울 학"));

// 자음 → 특수문자 (MS IME 원본 표)
let shapes = okpyeon::symbols('ㅁ').unwrap();
assert!(shapes.contains(&'※'));

// 알려진 결함 2건을 보정한 표 (날개셋 / 최신 Windows 동작)
assert_eq!(okpyeon::symbols_revised('ㄹ').unwrap()[3], '°');
assert_eq!(okpyeon::symbols_revised('ㅁ').unwrap().last(), Some(&'㉾'));

The symbol tables define 18 keys, matching Windows MS IME: punctuation, brackets, math, units, general symbols, box drawing, / enclosed hangul/latin, fullwidth digits, fractions, / modern/archaic jamo, fullwidth latin, greek, extended latin, hiragana, katakana, cyrillic. has no assignment, faithful to MS IME.

Data provenance

Both tables are vendored in data/ from libhangul (commit a34aef7) and compiled into sorted static slices by build.rs:

  • data/hanja.txt — libhangul's data/hanja/hanja.txt, filtered to entries whose key and value are each a single character (multi-syllable word entries plus two anomalous multi-character-value entries removed; run scripts/update-data.sh to regenerate). Candidate order preserves the file order, which libhangul curates common-first, so it is directly usable as an IME candidate list. libhangul's separate frequency file (freq-hanja.txt, unclear licensing) is not used.
  • data/mssymbol.txt — libhangul's data/hanja/mssymbol.txt, verbatim. symbols is faithful to it, including two known quirks inherited from old MS IME: 's 4th slot is a fullwidth (a duplicate of the one in the fullwidth-latin table) where ° is expected, and is missing. symbols_revised corrects both, matching the 날개셋 input method and current Windows respectively.

License

The crate's own code is dual-licensed under either of

at your option.

The vendored data files (data/hanja.txt, data/mssymbol.txt) are from libhangul, copyright (c) Choe Hwanjin, licensed under the BSD 3-Clause license; each file retains its original copyright and license header. The compiled crate therefore contains BSD-3-Clause-licensed data (SPDX: (MIT OR Apache-2.0) AND BSD-3-Clause).

About

Korean IME candidate data: hanja lookup (옥편) + MS-IME-style consonant symbol tables. Rust, no_std, zero deps; data from libhangul.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages