def declarative_present_informal_low(infinitive, regular=False, further_use=False): infinitive = base2(infinitive, regular) if not further_use and ((infinitive[-1] == u'이' and not getattr(infinitive, 'hidden_padchim', False)) or \ infinitive == u'아니'): conjugation.reasons.append(u'야 irregular') return infinitive + u'야' # 르 irregular if regular and infinitive == u'이르': return u'일러' if is_l_euh_irregular(infinitive, regular): new_base = infinitive[:-2] + join(lead(infinitive[-2]), vowel(infinitive[-2]), u'ᆯ') if infinitive[-2:] in [u'푸르', u'이르']: new_base = new_base + join(u'ᄅ', vowel(find_vowel_to_append(new_base))) conjugation.reasons.append(u'irregular stem + %s -> %s' % (infinitive, new_base)) return infinitive + u'러' elif find_vowel_to_append(infinitive[:-1]) == u'아': new_base += u'라' conjugation.reasons.append(u'르 irregular stem change [%s -> %s]' % (infinitive, new_base)) return new_base else: new_base += u'러' conjugation.reasons.append(u'르 irregular stem change [%s -> %s]' % (infinitive, new_base)) return new_base elif infinitive[-1] == u'하': return merge(infinitive, u'여') elif is_h_irregular(infinitive, regular): return merge(infinitive, u'이') return merge(infinitive, find_vowel_to_append(infinitive))
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 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 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 base3(infinitive, regular=False): infinitive = base(infinitive, regular) if infinitive == u'아니': return u'아니' if infinitive == u'푸': return u'푸' if infinitive == u'뵙': return u'뵈' if is_h_irregular(infinitive, regular): return infinitive[:-1] + join(lead(infinitive[-1]), vowel(infinitive[-1])) elif is_p_irregular(infinitive, regular): return infinitive[:-1] + join(lead(infinitive[-1]), vowel(infinitive[-1])) + u'우' else: return base2(infinitive, regular)
def base2(infinitive, regular=False): infinitive = base(infinitive, regular) if infinitive == u'아니': infinitive = Geulja(u'아니') infinitive.hidden_padchim = True return infinitive if infinitive == u'뵙': return u'뵈' if infinitive == u'푸': return u'퍼' new_infinitive = infinitive if is_h_irregular(infinitive, regular): new_infinitive = merge(infinitive[:-1] + join(lead(infinitive[-1]), vowel(infinitive[-1])), u'이') conjugation.reasons.append(u'ㅎ irregular (%s -> %s)' % (infinitive, new_infinitive)) # ㅂ irregular elif is_p_irregular(infinitive, regular): # only some verbs get ㅗ (highly irregular) if infinitive in [u'묻잡'] or infinitive[-1] in [u'돕', u'곱']: new_vowel = u'ㅗ' else: new_vowel = u'ㅜ' new_infinitive = merge(infinitive[:-1] + join(lead(infinitive[-1]), vowel(infinitive[-1])), join(u'ᄋ', new_vowel)) conjugation.reasons.append(u'ㅂ irregular (%s -> %s)' % (infinitive, new_infinitive)) # ㄷ irregular elif is_d_irregular(infinitive, regular): new_infinitive = Geulja(infinitive[:-1] + join(lead(infinitive[-1]), vowel(infinitive[-1]), u'ᆯ')) new_infinitive.original_padchim = u'ᆮ' conjugation.reasons.append(u'ㄷ irregular (%s -> %s)' % (infinitive, new_infinitive)) elif is_s_irregular(infinitive, regular): new_infinitive = Geulja(infinitive[:-1] + join(lead(infinitive[-1]), vowel(infinitive[-1]))) new_infinitive.hidden_padchim = True conjugation.reasons.append(u'ㅅ irregular (%s -> %s [hidden padchim])' % (infinitive, new_infinitive)) return new_infinitive
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 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 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:])
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'ㅓ')) merge_rules.append(vowel_contraction(u'ㅓ', u'ㅣ', u'ㅐ'))