def attach_flags(word): pos_default_flags = { '명사': [], '대명사': [], '특수:복수접미사': [plural_suffix_flag], '특수:알파벳': [alpha_flag], '특수:숫자': [digit_flag], '특수:수:1': [number_1_flag], '특수:수:10': [number_10_flag], '특수:수:100': [number_100_flag], '특수:수:1000': [number_1000_flag], '특수:수:10000': [number_10000_flag], '특수:고유수:1': [knumber_1_flag], '특수:고유수:10': [knumber_10_flag], '특수:금지어': [forbidden_flag], '내부:활용:-어': [conjugation_eo_flag], '내부:활용:-은': [conjugation_eun_flag], '내부:활용:-을': [conjugation_eul_flag], } try: word.flags = pos_default_flags[word.pos] except KeyError: pass if word.pos == '동사' or word.pos == '형용사': word.flags += suffix.find_flags(word.word, word.pos, word.props) word.flags += josa.find_flags(word.word, word.pos, word.props) prop_default_flags = { '단위명사': [counter_flag], '보조용언:-어': [auxiliary_eo_flag], '보조용언:-은': [auxiliary_eun_flag], '보조용언:-을': [auxiliary_eul_flag], } for prop in word.props: try: word.flags += prop_default_flags[prop] except KeyError: pass word.flags.sort()
def attach_flags(word): pos_default_flags = { "명사": [], "대명사": [], "특수:복수접미사": [plural_suffix_flag], "특수:알파벳": [alpha_flag], "특수:숫자": [digit_flag], "특수:수:1": [number_1_flag], "특수:수:10": [number_10_flag], "특수:수:100": [number_100_flag], "특수:수:1000": [number_1000_flag], "특수:수:10000": [number_10000_flag], "특수:고유수:1": [knumber_1_flag], "특수:고유수:10": [knumber_10_flag], "특수:금지어": [forbidden_flag], "내부:활용:-어": [conjugation_eo_flag], "내부:활용:-은": [conjugation_eun_flag], "내부:활용:-을": [conjugation_eul_flag], } try: word.flags = pos_default_flags[word.pos] except KeyError: pass if word.pos == "동사" or word.pos == "형용사": word.flags += suffix.find_flags(word.word, word.pos, word.props) word.flags += josa.find_flags(word.word, word.pos, word.props) prop_default_flags = { "단위명사": [counter_flag], "보조용언:-어": [auxiliary_eo_flag], "보조용언:-은": [auxiliary_eun_flag], "보조용언:-을": [auxiliary_eul_flag], } for prop in word.props: try: word.flags += prop_default_flags[prop] except KeyError: pass word.flags.sort()
def attach_flags(self): pos_default_flags = { '명사': [substantive_flag, noun_flag], '대명사': [substantive_flag, pronoun_flag], '수사': [substantive_flag], '특수:복수접미사': [substantive_flag, plural_suffix_flag, onlyincompound_flag], '특수:알파벳': [alpha_flag], '특수:숫자': [digit_flag], '특수:금지어': [forbidden_flag], '내부:활용:-어': [conjugation_eo_flag, onlyincompound_flag], '내부:활용:-은': [conjugation_eun_flag, onlyincompound_flag], '내부:활용:-을': [conjugation_eul_flag, onlyincompound_flag], '내부:이다:-어': [ida_eo_flag, onlyincompound_flag], '내부:이다:-은': [ida_eun_flag, onlyincompound_flag], '내부:이다:-을': [ida_eul_flag, onlyincompound_flag], } try: self.flags = pos_default_flags[self.pos] except KeyError: pass pos_detail_default_flags = { '명사:의존:단위성': [counter_flag], } try: self.flags += pos_detail_default_flags[self.pos_detail] except KeyError: pass if self.pos in ('명사', '대명사', '수사'): if self.ends_with_vowel(): self.flags += [substantive_v_flag] if self.pos == '명사': self.flags += [noun_v_flag] else: self.flags += [substantive_t_flag] if self.pos == '명사': self.flags += [noun_t_flag] if self.pos == '대명사': if self.word == '너' or self.word == '나': pass else: self.flags += [pronoun_plural_flag] elif self.pos == '동사' or self.pos == '형용사': self.flags += suffix.find_flags(self.word, self.pos, self.props) self.flags += josa.find_flags(self.word, self.pos, self.props) prop_default_flags = { '단위명사': [counter_flag], '보조용언:-어': [auxiliary_eo_flag], '보조용언:-은': [auxiliary_eun_flag], '보조용언:-을': [auxiliary_eul_flag], '수:1': [number_1_flag], '수:10': [number_10_flag], '수:100': [number_100_flag], '수:1000': [number_1000_flag], '수:10000': [number_10000_flag], '고유수:1': [knumber_1_flag], '고유수:10': [knumber_10_flag], } for prop in self.props: try: self.flags += prop_default_flags[prop] except KeyError: pass self.flags.sort()