def move_padchim_to_replace_eung(x, y): if padchim(x[-1]) in padchim_to_lead.keys() and lead(y[0]) == u'ᄋ': return (x[:-1] + join(lead(x[-1]), vowel(x[-1])), join(padchim_to_lead[padchim(x[-1])], vowel(y[0]), padchim(y[0])) + \ y[1:])
def move_padchim_to_replace_eung(x, y): if padchim(x[-1]) in list(padchim_to_lead.keys()) and lead(y[0]) == 'ᄋ': return (x[:-1] + join(lead(x[-1]), vowel(x[-1])), join(padchim_to_lead[padchim(x[-1])], vowel(y[0]), padchim(y[0])) + \ y[1:])
def rule(x, y): if y_vowel and vowel(y[0]) != y_vowel: return if (padchim(x[-1]) == x_padchim or x_padchim == '*') and \ (lead(y[0]) == y_lead or y_lead == '*'): return (x[:-1] + join(lead(x[-1]), vowel(x[-1]), new_padchim == '*' and padchim(x[-1]) or new_padchim), join(new_lead == '*' and lead(y[0]) or new_lead, vowel(y[0]), padchim(y[0])) + \ y[1:])
def rule(x, y): if y_vowel and vowel(y[0]) != y_vowel: return if (padchim(x[-1]) == x_padchim or x_padchim == u'*') and \ (lead(y[0]) == y_lead or y_lead == u'*'): return (x[:-1] + join(lead(x[-1]), vowel(x[-1]), new_padchim == u'*' and padchim(x[-1]) or new_padchim), join(new_lead == u'*' and lead(y[0]) or new_lead, vowel(y[0]), padchim(y[0])) + \ y[1:])
def rule(x, y): if match(x[-1], u'*', vowel1, None) and \ match(y[0], u'ᄋ', vowel2): return (u'vowel contraction [%s + %s -> %s]' % (vowel1, vowel2, new_vowel), x[:-1] + join(lead(x[-1]), new_vowel, padchim(y[0])) + y[1:])
def rule(x, y): if padchim(x[-1]) in changers: return (x[:-1] + join(lead(x[-1]), vowel(x[-1]), to), y)
def rule(x, y): if padchim(x[-1]) and y[0] in characters: return (u'padchim + consonant -> insert 으', x + u'으' + y)
def drop_l_and_borrow_padchim(x, y): if padchim(x[-1]) == u'ᆯ': conjugation.reasons.append(u'drop %s borrow padchim' % padchim(x[-1])) return x[:-1] + join(lead(x[-1]), vowel(x[-1]), padchim(y[0])) + y[1:]
def drop_l(x, y): if padchim(x[-1]) == u'ᆯ': conjugation.reasons.append(u'drop ㄹ') return x[:-1] + join(lead(x[-1]), vowel(x[-1])) + y
def is_h_irregular(infinitive, regular=False): if regular: return False return (padchim(infinitive[-1]) == u'ᇂ' or infinitive[-1] == u'러') and \ not not_h_irregular.get(after_last_space(infinitive), False)
def rule(x, y): if not padchim(x[-1]) and y[0] in characters: return (u'borrow padchim', x[:-1] + join(lead(x[-1]), vowel(x[-1]), padchim(y[0])) + y[1:])
return x[:-1] + join(lead(x[-1]), vowel(x[-1]), padchim(y[0])) + y[1:] def insert_eh(characters): def rule(x, y): if padchim(x[-1]) and y[0] in characters: return (u'padchim + consonant -> insert 으', x + u'으' + y) return rule # merge rules is a list of rules that are applied in order when merging a verb # stem with a tense ending merge_rules = [] merge_rules.append(no_padchim_rule([u'을', u'습', u'읍', u'는', u'음'])) merge_rules.append(lambda x, y: padchim(x[-1]) == u'ᆯ' and y[0] == u'음' and \ [u'ㄹ + ㅁ -> ᆱ', x[:-1] + join(lead(x[-1]), vowel(x[-1]), u'ᆱ')]) # vowel contractions merge_rules.append(vowel_contraction(u'ㅐ', u'ㅓ', u'ㅐ')) merge_rules.append(vowel_contraction(u'ㅡ', u'ㅓ', u'ㅓ')) merge_rules.append(vowel_contraction(u'ㅜ', u'ㅓ', u'ㅝ')) merge_rules.append(vowel_contraction(u'ㅗ', u'ㅏ', u'ㅘ')) merge_rules.append(vowel_contraction(u'ㅚ', u'ㅓ', u'ㅙ')) merge_rules.append(vowel_contraction(u'ㅙ', u'ㅓ', u'ㅙ')) merge_rules.append(vowel_contraction(u'ㅘ', u'ㅓ', u'ㅘ')) merge_rules.append(vowel_contraction(u'ㅝ', u'ㅓ', u'ㅝ')) merge_rules.append(vowel_contraction(u'ㅏ', u'ㅏ', u'ㅏ')) merge_rules.append(vowel_contraction(u'ㅡ', u'ㅏ', u'ㅏ')) merge_rules.append(vowel_contraction(u'ㅣ', u'ㅓ', u'ㅕ')) merge_rules.append(vowel_contraction(u'ㅓ', u'ㅓ', u'ㅓ'))