def get(word, tense: int, irregular: bool):
     if tense == NounForm.PRESENT:
         st1 = stem2.get_stem1(word)
         letters = jamo.decompose(st1[-1])
         if len(letters) == 3 and letters[2] == stem2.final_l:
             nominalization = (st1[:-1] +
                               jamo.compose(letters[0], letters[1], 'ᆱ'))
         else:
             nominalization = stem2.get_stem1(word) + '음'
         return [nominalization, stem2.get_stem1(word) + '기']
     elif tense == NounForm.PAST:
         past = get_past(word, irregular)
         return [past + '음', past + '기']
def get_present_determiner(word):
    stem1 = stem2.get_stem1(word)
    letters = jamo.decompose(stem1[-1])
    if len(letters) == 3 and letters[2] == stem2.final_l:
        return stem1[:-1] + jamo.compose(letters[0], letters[1], None) + '는'
    else:
        return stem1 + '는'
def get_plain_interrogative(word: str):
    stem1 = stem2.get_stem1(word)
    letters = jamo.decompose(stem1[-1])
    if len(letters) == 3 and letters[2] == stem2.final_l:
        return stem1[:-1] + jamo.compose(letters[0], letters[1],
                                         None) + '니'  # '냐'
    else:
        return stem1 + '니'  # '으' + '냐'
def get_eupsi(word):
    stem1 = stem2.get_stem1(word)
    letters = jamo.decompose(stem1[-1])
    if len(letters) == 3 and letters[2] != stem2.final_l:
        return stem1 + '읍시'
    else:
        return stem1[:-1] + jamo.compose(letters[0], letters[1],
                                         stem2.final_p) + '시'
def get_seumni(word):
    stem1 = stem2.get_stem1(word)
    letters = jamo.decompose(stem1[-1])
    if len(letters) == 3 and letters[2] != stem2.final_l:
        return stem1 + polite_formal_suffix
    else:
        return stem1[:-1] + jamo.compose(letters[0], letters[1],
                                         stem2.final_p) + '니'
def get_plain(word: str, adjective: bool):
    if adjective:
        return word
    stem1 = stem2.get_stem1(word)
    letters = jamo.decompose(stem1[-1])
    if len(letters) == 2 or letters[2] == stem2.final_l:
        return stem1[:-1] + jamo.compose(
            letters[0], letters[1],
            stem2.final_n) + word_ending  # final l -> n
    else:
        return stem1 + '는' + word_ending
 def assertive(word, formal, polite):
     assertive_suffix = '겠'
     conjugate_methods = {
         # non-past
         (TENSE_NON_PAST, STYLE_FORMAL, STYLE_POLITE):
         lambda x: stem2.get_stem1(
             word) + assertive_suffix + polite_formal_suffix + word_ending,
         (TENSE_NON_PAST, STYLE_FORMAL, STYLE_NON_POLITE):
         lambda x: stem2.get_stem1(word) + assertive_suffix + word_ending,
         (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_POLITE):
         lambda x: stem2.get_stem1(word) + assertive_suffix + '어' +
         polite_ending,
         (TENSE_NON_PAST, STYLE_INFORMAL, STYLE_NON_POLITE):
         lambda x: stem2.get_stem1(word) + assertive_suffix + '어'
     }
     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 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 get_past_and_future_determiner(word, irregular, regular_ending,
                                   p_irregular_ending, ending_final):
    stem1 = stem2.get_stem1(word)
    letters = jamo.decompose(stem1[-1])
    if irregular and len(letters) == 3:
        if letters[2] == stem2.final_s:
            return stem1[:-1] + jamo.compose(
                letters[0], letters[1], None) + regular_ending  # s removed
        elif letters[2] == stem2.final_t:
            return stem1[:-1] + jamo.compose(
                letters[0], letters[1],
                stem2.final_l) + regular_ending  # t -> l
        elif letters[2] == stem2.final_p:
            return stem1[:-1] + jamo.compose(
                letters[0], letters[1],
                None) + p_irregular_ending  # p -> un/ul

    if len(letters) == 2 or letters[2] == stem2.final_l or letters[
            2] == stem2.final_h:
        return stem1[:-1] + jamo.compose(letters[0], letters[1], ending_final)
    else:
        return stem1 + regular_ending
 def testStem1(self):
     self.assertEqual('가', get_stem1('가다'))
Esempio n. 11
0
def get_stem3(word: str, irregular: bool):
    return stem1_to_stem3(stem2.get_stem1(word), irregular)
Esempio n. 12
0
 def conjunction(word):
     st1 = stem2.get_stem1(word)
     return [st1 + '고']
Esempio n. 13
0
 def contrast(word):
     st1 = stem2.get_stem1(word)
     return [st1 + '지만', st1 + '는데', st1 + '더니']