okpyeon (옥편)
한국어 입력기의 한자 키가 필요로 하는 두 가지 정적 후보 데이터: 독음 → 한자
후보(훈음 포함), 그리고 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 = hanja.unwrap;
assert_eq!;
// 자음 → 특수문자 (MS IME 원본 표)
let shapes = symbols.unwrap;
assert!;
// 알려진 결함 2건을 보정한 표 (날개셋 / 최신 Windows 동작)
assert_eq!;
assert_eq!;
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'sdata/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; runscripts/update-data.shto 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'sdata/hanja/mssymbol.txt, verbatim.symbolsis faithful to it, including two known quirks inherited from old MS IME:ㄹ's 4th slot is a fullwidthF(a duplicate of the one in theㅍfullwidth-latin table) where°is expected, and㉾is missing.symbols_revisedcorrects both, matching the 날개셋 input method and current Windows respectively.
License
The crate's own code is dual-licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
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).