hanmo 0.1.0

Hangul syllable composition/decomposition and jamo conversion: conjoining jamo (U+1100) <-> precomposed syllables (U+AC00) <-> compatibility jamo (U+3130), plus cho/jong consonant conversion.
Documentation
  • Coverage
  • 100%
    33 out of 33 items documented1 out of 17 items with examples
  • Size
  • Source code size: 31.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 443.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • chaotic-ground/hanmo
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lens0021

hanmo (한모)

crates.io docs.rs

한글 음절 조합/분해와 자모 변환을 위한 작은 순수 유니코드 라이브러리. 자모를 모아 음절을 만든다(모아쓰기)는 데서 이름을 땄습니다.

A small, dependency-free, pure-Unicode Rust library for Hangul (한글) syllable composition / decomposition and jamo conversion. It bridges the three layers of Hangul code points and converts a consonant between initial/final position. No input-method or configuration logic, just Unicode facts.

  • Conjoining jamo (첫가끝, U+1100..): letters that combine into a block.
  • Precomposed syllables (U+AC00.., e.g. ): a finished syllable.
  • Compatibility jamo (U+3130.., e.g. ): standalone letter forms.

Usage

// 조합 / 분해 (compose / decompose)
assert_eq!(hanmo::compose(0x1100, 0x1161, None), Some(''));         // ㄱ + ㅏ
assert_eq!(hanmo::compose(0x1100, 0x1161, Some(0x11A8)), Some('')); // + ㄱ받침
assert_eq!(hanmo::decompose(''), Some((0x1100, 0x1161, Some(0x11A8))));

// 호환 자모 다리 (conjoining <-> compatibility jamo)
assert_eq!(hanmo::cho_cp_for_compat(0x3131), Some(0x1100)); // ㄱ -> 초성 ㄱ
assert_eq!(hanmo::jung_compat(0x1161), Some(0x314F));       // 중성 ㅏ -> ㅏ

// 초성 <-> 종성 (initial <-> final consonant)
assert_eq!(hanmo::cho_to_jong(0x1100), Some(0x11A8)); // ㄱ초성 -> ㄱ종성
assert_eq!(hanmo::jong_to_cho(0x11BC), Some(0x110B)); // ㅇ종성 -> ㅇ초성

What it does

Area Functions
음절 조합/분해 compose, compose_indices, decompose
자모 인덱스 cho_index, jung_index, jong_index, is_conjoining_jamo
호환 자모 다리 cho_compat / jung_compat / jong_compat, cho_cp_for_compat / jung_cp_for_compat / jong_cp_for_compat, is_vowel_compat
초성↔종성 변환 cho_to_jong, jong_to_cho
표 (constants) CHO/JUNG/JONG, CHO_COMPAT/JUNG_COMPAT/JONG_COMPAT, SBASE/LBASE/VBASE/TBASE, …

Only modern Hangul precomposes (U+AC00 block); old-Hangul conjoining jamo are recognized by is_conjoining_jamo but have no precomposed form.

License

Dual-licensed under either of

at your option.