okpyeon 0.1.0

Korean IME candidate data: hangul reading -> hanja candidates with hun-eum glosses (옥편), plus the MS-IME-style consonant -> special-symbol tables (ㅁ + 한자). Data from libhangul, single-character lookups only.
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented4 out of 4 items with examples
  • Size
  • Source code size: 475.84 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 117.47 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • chaotic-ground/okpyeon
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lens0021

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).