hgtk/letter.py
def decompose(hangul_letter):
    """This function returns letters by decomposing the specified Hangul letter."""

    from . import checker

    if len(hangul_letter) < 1:
        raise NotLetterException('')
    elif not checker.is_hangul(hangul_letter):
        raise NotHangulException('')

    if hangul_letter in CHO:
        return hangul_letter, '', ''

    if hangul_letter in JOONG:
        return '', hangul_letter, ''

    if hangul_letter in JONG:
        return '', '', hangul_letter

    code = hangul_index(hangul_letter)
    cho, joong, jong = decompose_index(code)

    if cho < 0:
        cho = 0

    try:
        return CHO[cho], JOONG[joong], JONG[jong]
    except:
        print("%d / %d  / %d"%(cho, joong, jong))
        print("%s / %s " %( JOONG[joong].encode("utf8"), JONG[jong].encode('utf8')))
        raise Exception()
def decompose(hangul_letter):
    from . import checker

    if len(hangul_letter) < 1:
        raise NotLetterException('')
    elif not checker.is_hangul(hangul_letter):
        raise NotHangulException('')

    if hangul_letter in CHO:
        return hangul_letter, '', ''

    if hangul_letter in JOONG:
        return '', hangul_letter, ''

    if hangul_letter in JONG:
        return '', '', hangul_letter

    code = hangul_index(hangul_letter)
    cho, joong, jong = decompose_index(code)

    if cho < 0:
        cho = 0

    try:
        return CHO[cho], JOONG[joong], JONG[jong]
    except:
        print("%d / %d  / %d"%(cho, joong, jong))
        print("%s / %s " %( JOONG[joong].encode("utf8"), JONG[jong].encode('utf8')))
        raise Exception()
def decompose ( hangul_letter ) : from . import checker if len ( hangul_letter ) < 1 : raise NotLetterException ( '' ) elif not checker . is_hangul ( hangul_letter ) : raise NotHangulException ( '' ) if hangul_letter in CHO : return hangul_letter , '' , '' if hangul_letter in JOONG : return '' , hangul_letter , '' if hangul_letter in JONG : return '' , '' , hangul_letter code = hangul_index ( hangul_letter ) cho , joong , jong = decompose_index ( code ) if cho < 0 : cho = 0 try : return CHO [ cho ] , JOONG [ joong ] , JONG [ jong ] except : print ( "%d / %d  / %d" % ( cho , joong , jong ) ) print ( "%s / %s " % ( JOONG [ joong ] . encode ( "utf8" ) , JONG [ jong ] . encode ( 'utf8' ) ) ) raise Exception ( )
This function returns letters by decomposing the specified Hangul letter.
This function returns letters by decomposing the specified Hangul letter .