hangul.dev

Korean text processing for developers

$
UTF-8 Unicode 15.0 Jamo

Decomposition

Break any Hangul syllable into its constituent jamo — initial consonant, medial vowel, and optional final consonant.

decompose.ts
1import { decompose } from '@hangul/dev'
2
3const result = decompose('한글')
4// => ['ㅎ', 'ㅏ', 'ㄴ', 'ㄱ', 'ㅡ', 'ㄹ']
5
6const detailed = decompose('한', { mode: 'full' })
7// => { initial: 'ㅎ', medial: 'ㅏ', final: 'ㄴ' }

Composition

Assemble individual jamo back into complete Hangul syllables programmatically.

compose.ts
1import { compose } from '@hangul/dev'
2
3const syllable = compose('ㅎ', 'ㅏ', 'ㄴ')
4// => '한'
5
6const word = compose(['ㅎ','ㅏ','ㄴ'], ['ㄱ','ㅡ','ㄹ'])
7// => '한글'

Detection & Romanization

Identify Hangul text and convert it to standard romanization formats.

romanize.ts
1import { isHangul, romanize } from '@hangul/dev'
2
3isHangul('가') // true
4isHangul('A') // false
5isHangul('한글 abc') // false (mixed)
6
7romanize('한글') // 'hangeul'
8romanize('서울') // 'seoul'
9romanize('부산', { system: 'revised' })
10// => 'busan'

Search & Matching

Fuzzy and initial-consonant search for Korean text input autocompletion.

search.ts
1import { search, chosungMatch } from '@hangul/dev'
2
3const items = ['사과', '바나나', '딸기', '수박']
4
5search(items, '사') // ['사과']
6chosungMatch('ㅂㄴㄴ', '바나나')
7// => true

Jamo Reference Table

The 14 basic consonants (초성) and 10 basic vowels (중성) of the Korean alphabet.

Consonants 초성 choseong

g/kU+3131
nU+3134
d/tU+3137
r/lU+3139
mU+3141
b/pU+3142
sU+3145
-/ngU+3147
jU+3148
chU+314A
kU+314B
tU+314C
pU+314D
hU+314E

Vowels 중성 jungseong

aU+314F
yaU+3151
eoU+3153
yeoU+3155
oU+3157
yoU+315B
uU+315C
yuU+3160
euU+3161
iU+3163

Double Consonants 쌍자음 ssang-jaeum

kkU+3132
ttU+3138
ppU+3143
ssU+3146
jjU+3149
terminal
$ npm install @hangul/dev
added 1 package in 0.4s
v2.4.1 12.3 kB gzipped MIT
$ yarn add @hangul/dev
$ pnpm add @hangul/dev

Ready.