def indicative(word, is_verb, is_irregular, tense, formal, polite): conjugate_methods = { # non-past (TENSE_NON_PAST, STYLE_FORMAL, STYLE_POLITE): lambda x: get_seumni(word) + word_ending, (TENSE_NON_PAST, STYLE_FORMAL, STYLE_NON_POLITE): lambda x: get_plain(word, adjective=not is_verb), (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_POLITE): lambda x: stem2.get_stem2(word, is_irregular) + polite_ending, (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_NON_POLITE): lambda x: stem2.get_stem2(word, is_irregular), # past (TENSE_PAST, STYLE_FORMAL, STYLE_POLITE): lambda x: get_past(word, irregular=is_irregular ) + polite_formal_suffix + word_ending, (TENSE_PAST, STYLE_FORMAL, STYLE_NON_POLITE): lambda x: get_past(word, irregular=is_irregular) + word_ending, (TENSE_PAST, STYLE_INFORMAL, STYLE_POLITE): lambda x: get_past(word, irregular=is_irregular) + '어' + polite_ending, (TENSE_PAST, STYLE_INFORMAL, STYLE_NON_POLITE): lambda x: get_past(word, irregular=is_irregular) + '어', } method = conjugate_methods.get((tense, formal, polite)) if method: return method(word) else: raise RuntimeError(f'{tense}, {formal}, {polite} not implemented')
def hortative(word, formal, polite): conjugate_methods = { # non-past (TENSE_NON_PAST, STYLE_FORMAL, STYLE_POLITE): lambda x: get_eupsi(word) + '다', (TENSE_NON_PAST, STYLE_FORMAL, STYLE_NON_POLITE): lambda x: stem2.get_stem2(word) + '자', (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_POLITE): lambda x: stem2.get_stem2(word) + polite_ending, (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_NON_POLITE): lambda x: stem2.get_stem1(word) } method = conjugate_methods.get((TENSE_NON_PAST, formal, polite)) if method: return method(word) else: raise RuntimeError( f'Assertive form of {formal}, {polite} not implemented')
def interrogative(word: str, is_irregular: bool, tense, formal, polite): """ 해체 STYLE_INFORMAL, STYLE_NON_POLITE 해라체 STYLE_FORMAL, STYLE_NON_POLITE 해요체 STYLE_INFORMAL, STYLE_POLITE 하십시오체 STYLE_FORMAL, STYLE_POLITE :param word: :param is_irregular: :param tense: :param formal: :param polite: :return: """ conjugate_methods = { # non-past (TENSE_NON_PAST, STYLE_FORMAL, STYLE_POLITE): lambda x: get_seumni(word) + '까', (TENSE_NON_PAST, STYLE_FORMAL, STYLE_NON_POLITE): lambda x: get_plain_interrogative(word), (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_POLITE): lambda x: stem2.get_stem2(word, is_irregular) + polite_ending, (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_NON_POLITE): lambda x: stem2.get_stem2(word, is_irregular), # past (TENSE_PAST, STYLE_FORMAL, STYLE_POLITE): lambda x: get_past(word, irregular=is_irregular) + polite_formal_suffix + polite_formal_question_ending, (TENSE_PAST, STYLE_FORMAL, STYLE_NON_POLITE): lambda x: get_plan_past_interrogative(word, irregular=is_irregular ), (TENSE_PAST, STYLE_INFORMAL, STYLE_POLITE): lambda x: get_past(word, is_irregular) + '어' + polite_ending, (TENSE_PAST, STYLE_INFORMAL, STYLE_NON_POLITE): lambda x: get_past(word, is_irregular) + '어', } method = conjugate_methods.get((tense, formal, polite)) if method: return method(word) else: raise RuntimeError(f'{tense}, {formal}, {polite} not implemented')
def get_past(word, irregular): stem = stem2.get_stem2(word, irregular) letters = jamo.decompose(stem[-1]) assert (len(letters) == 2) return stem[:-1] + jamo.compose(letters[0], letters[1], final_ss)
def condition(word, irregular: bool): return [ stem3.get_stem3(word, irregular=irregular) + '면', stem2.get_stem2(word, irregular=irregular) + '야' ]
def reason(word: str, irregular: bool): st2 = stem2.get_stem2(word, irregular=irregular) st3 = stem3.get_stem3(word, irregular=irregular) return [st2, st2 + '서', st3 + '니', st3 + '니까']