Jamo: Hangul Syllable and Jamo Analyzer

0.4.1 · active · verified Tue Apr 14

Jamo is a Python library designed for the decomposition and synthesis of Hangul syllables into their constituent jamo characters. It supports both the U+11xx jamo characters and Hangul Compatibility Jamo (HCJ, U+31xx) for display purposes. Currently in beta release (version 0.4.1), the library primarily focuses on modern Hangul. While releases are sporadic, the project is actively maintained, with documentation reflecting the 0.4-beta interface.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to decompose Hangul syllables into jamo characters, convert them to Hangul Compatibility Jamo (HCJ) for display, and synthesize Hangul syllables back from individual jamo.

from jamo import h2j, j2h, j2hcj

# Hangul Decomposition (to U+11xx jamo)
hangul_text = "안녕하세요"
decomposed_jamo = h2j(hangul_text)
print(f"Decomposed (U+11xx): {decomposed_jamo}")

# Convert U+11xx jamo to Hangul Compatibility Jamo (HCJ) for display
display_jamo = j2hcj(decomposed_jamo)
print(f"Decomposed (HCJ): {display_jamo}")

# Hangul Synthesis
lead = 'ㅇ'
vowel = 'ㅏ'
tail = 'ㄴ'
synthesized_hangul = j2h(lead, vowel, tail)
print(f"Synthesized: {synthesized_hangul}")

# Using splat operator for synthesis from a string of jamo
jamo_string = 'ㅇㅏㄴ'
synthesized_from_string = j2h(*jamo_string)
print(f"Synthesized from string: {synthesized_from_string}")

view raw JSON →