Beispiel #1
0
def test_is_syllable():
    assert is_syllable('가')
    assert is_syllable('갛')
    assert is_syllable('힣')
Beispiel #2
0
from hangul_jamo import is_syllable, is_jamo_character, compose_jamo_characters, decompose_syllable, compose, decompose

# 1. CHECKING HANGUL SYLLABLES
print('is_syllable("가") ==', is_syllable('가'))
# is_syllable("가") == True
print('is_syllable("갛") ==', is_syllable('갛'))
# is_syllable("갛") == True
print('is_syllable("ㄱ") ==', is_syllable('ㄱ'))
# is_syllable("ㄱ") == False

# 2. CHECKING HANGUL JAMO CHARACTERS
print('is_jamo_character("ㄱ") ==', is_jamo_character('ㄱ'))
# is_jamo_character("ㄱ") == True
print('is_jamo_character("ㅏ") ==', is_jamo_character('ㅏ'))
# is_jamo_character("ㅏ") == True
print('is_jamo_character("ㄳ") ==', is_jamo_character('ㄳ'))
# is_jamo_character("ㄳ") == True
print('is_jamo_character("갃") ==', is_jamo_character('갃'))
# is_jamo_character("갃") == False

# 3. COMPOSING HANGUL JAMO CHARACTERS
print('compose_jamo_characters("ㄱ", "ㅏ", None) ==',
      compose_jamo_characters('ㄱ', 'ㅏ', None))
# compose_jamo_characters("ㄱ", "ㅏ", None) == 가
print('compose_jamo_characters("ㄱ", "ㅏ") ==',
      compose_jamo_characters('ㄱ', 'ㅏ'))
# compose_jamo_characters("ㄱ", "ㅏ") == 가
print('compose_jamo_characters("ㄱ", "ㅏ", "ㅎ") ==',
      compose_jamo_characters('ㄱ', 'ㅏ', 'ㅎ'))
# compose_jamo_characters("ㄱ", "ㅏ", "ㅎ") == 갛
Beispiel #3
0
def test_is_not_syllable():
    assert not is_syllable('0')
    assert not is_syllable('A')
    assert not is_syllable('a')