hangul-utils

For splitting and Korean unicode characters (syllables, jaeum, moeum) in Clojure


License
EPL-1.0

Documentation

hangul-utils

A Clojure library for manipulating Korean characters and alphabets.

Usage

This library represents a deconstructed Korean syllable as a vector of letters (or jamo).

(deconstruct \μ•ˆ)
;; => [\γ…‡ \ㅏ \γ„΄]

(deconstruct-str "μ•ˆλ…•ν•˜μ„Έμš”")
;; => [[\γ…‡ \ㅏ \γ„΄] [\γ„΄ \γ…• \γ…‡] [\γ…Ž \ㅏ] [\γ…… \γ…”] [\γ…‡ \γ…›]]

(construct [\γ…Ž \ㅏ])
;; => \ν•˜

(construct-str [[\γ…‹ \γ…‘ \γ„Ή] [\γ„Ή \γ…—] [\γ…ˆ \γ…•] [\space] [\γ…ˆ \ㅐ] [\ㅁ \γ…£ \γ…†] [\γ„΄ \γ…”] [\γ…‡ \γ…›]])
;; => "클둜져 μž¬λ°Œλ„€μš”"

You can also transform strings end-to-end:

(alphabetize "μ˜€λŠ˜λΆ€ν„°..!")
;; => "γ…‡γ…—γ„΄γ…‘γ„Ήγ…‚γ…œγ…Œγ…“..!"

(syllabize "γ„Ήγ…£γ…Šγ…£γ…Žγ…£γ…‹γ…£γ„΄γ…£γ… ㄱㅗㅁㅏㅂㅅㅑㅂㄴㅣㄷㅏ")
;; => "λ¦¬μΉ˜νžˆν‚€λ‹˜ κ³ λ§™μŠ΅λ‹ˆλ‹€"

Thanks

Thanks to kaniblu for the Python hangul-utils library, which inspired this.

License

Copyright Β© 2017 Sooheon Kim

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.