Skip to content

Commit

Permalink
fix coda ㅎ + initial ㄱㄷㅅㅈ pronouncer issue (e.g. 않습니다)
Browse files Browse the repository at this point in the history
  • Loading branch information
osori committed Aug 19, 2021
1 parent 92edd7d commit 745a7cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 7 additions & 5 deletions korean_romanizer/pronouncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,24 @@ def final_substitute(self):

# 4. 받침 ‘ㅎ’의 발음은 다음과 같다.
if syllable.final in ['ᇂ', 'ᆭ', 'ᆶ']:
without_ㅎ = {
'ᆭ' : 'ᆫ',
'ᆶ' : 'ᆯ',
'ᇂ' : None
}

if next_syllable:
# ‘ㅎ(ㄶ, ㅀ)’ 뒤에 ‘ㄱ, ㄷ, ㅈ’이 결합되는 경우에는, 뒤 음절 첫소리와 합쳐서 [ㅋ, ㅌ, ㅊ]으로 발음한다.
# ‘ㅎ(ㄶ, ㅀ)’ 뒤에 ‘ㅅ’이 결합되는 경우에는, ‘ㅅ’을 [ㅆ]으로 발음한다.
if next_syllable.initial in ['ᄀ', 'ᄃ', 'ᄌ', 'ᄉ']:
change_to = {'ᄀ': 'ᄏ','ᄃ': 'ᄐ','ᄌ':'ᄎ', 'ᄉ': 'ᄊ'}
syllable.final = None
syllable.final = without_ㅎ[syllable.final]
next_syllable.initial = change_to[next_syllable.initial]
# 3. ‘ㅎ’ 뒤에 ‘ㄴ’이 결합되는 경우에는, [ㄴ]으로 발음한다.
elif next_syllable.initial in ['ᄂ']:
# TODO: [붙임] ‘ㄶ, ㅀ’ 뒤에 ‘ㄴ’이 결합되는 경우에는, ‘ㅎ’을 발음하지 않는다.
if(syllable.final in ['ᆭ', 'ᆶ']):
if syllable.final == 'ᆭ':
syllable.final = 'ᆫ'
elif syllable.final == 'ᆶ':
syllable.final = 'ᆯ'
syllable.final = without_ㅎ[syllable.final]
else:
syllable.final = 'ᆫ'
#4. ‘ㅎ(ㄶ, ㅀ)’ 뒤에 모음으로 시작된 어미나 접미사가 결합되는 경우에는,
Expand Down
6 changes: 5 additions & 1 deletion tests/test_romanizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ def test_double_consonant_final_and_next_syllable_null_initial():

def test_non_syllables():
assert romanize("ㅠㄴㅁㄱ") == "ㅠㄴㅁㄱ"
assert romanize("ㅠ동") == "ㅠdong"
assert romanize("ㅠ동") == "ㅠdong"

def test_coda_h():
assert romanize("않습니다") == "ansseupnida"
assert romanize("앓고") == "alko"

0 comments on commit 745a7cb

Please sign in to comment.