Open the context
Choose the project folder and name the files or behavior involved.
Decompose one precomposed modern Hangul syllable into its leading, vowel and optional trailing jamo. Test syllables with and without a tail and both range endpoints, rejecting other characters rather than claiming general Unicode normalization.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def hangul_jamo(syllable):
if type(syllable) is not str or len(syllable) != 1 or not 0xAC00 <= ord(syllable) <= 0xD7A3:
raise ValueError("hangul.syllable")
index = ord(syllable) - 0xAC00
lead = chr(0x1100 + index // 588)
vowel = chr(0x1161 + (index % 588) // 28)
tail = index % 28
return lead + vowel + (chr(0x11A7 + tail) if tail else "")The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.