tossi/hangul.py
def split_phonemes(letter, onset=True, nucleus=True, coda=True):
    """Splits Korean phonemes as known as "자소" from a Hangul letter.

    :returns: (onset, nucleus, coda)
    :raises ValueError: `letter` is not a Hangul single letter.

    """
    if len(letter) != 1 or not is_hangul(letter):
        raise ValueError('Not Hangul letter: %r' % letter)
    offset = ord(letter) - FIRST_HANGUL_OFFSET
    phonemes = [None] * 3
    if onset:
        phonemes[0] = ONSETS[offset // (NUM_NUCLEUSES * NUM_CODAS)]
    if nucleus:
        phonemes[1] = NUCLEUSES[(offset // NUM_CODAS) % NUM_NUCLEUSES]
    if coda:
        phonemes[2] = CODAS[offset % NUM_CODAS]
    return tuple(phonemes)
def split_phonemes(letter, onset=True, nucleus=True, coda=True):
    """Splits Korean phonemes as known as "자소" from a Hangul letter.

    :returns: (onset, nucleus, coda)
    :raises ValueError: `letter` is not a Hangul single letter.

    """
    if len(letter) != 1 or not is_hangul(letter):
        raise ValueError('Not Hangul letter: %r' % letter)
    offset = ord(letter) - FIRST_HANGUL_OFFSET
    phonemes = [None] * 3
    if onset:
        phonemes[0] = ONSETS[offset // (NUM_NUCLEUSES * NUM_CODAS)]
    if nucleus:
        phonemes[1] = NUCLEUSES[(offset // NUM_CODAS) % NUM_NUCLEUSES]
    if coda:
        phonemes[2] = CODAS[offset % NUM_CODAS]
    return tuple(phonemes)
def split_phonemes ( letter , onset = True , nucleus = True , coda = True ) : if len ( letter ) != 1 or not is_hangul ( letter ) : raise ValueError ( 'Not Hangul letter: %r' % letter ) offset = ord ( letter ) - FIRST_HANGUL_OFFSET phonemes = [ None ] * 3 if onset : phonemes [ 0 ] = ONSETS [ offset // ( NUM_NUCLEUSES * NUM_CODAS ) ] if nucleus : phonemes [ 1 ] = NUCLEUSES [ ( offset // NUM_CODAS ) % NUM_NUCLEUSES ] if coda : phonemes [ 2 ] = CODAS [ offset % NUM_CODAS ] return tuple ( phonemes )
Splits Korean phonemes as known as "자소" from a Hangul letter.

    :returns: (onset, nucleus, coda)
    :raises ValueError: `letter` is not a Hangul single letter.
Splits Korean phonemes as known as 자소 from a Hangul letter .