Пример #1
0
def based_on_tag(filename, raw_text):
    """ based on tag (data/misspell_stem.xlsx) """
    # 1) get mis-spell data
    adjective, adjective_alt, \
    adverb, adverb_alt, \
    conjunction, conjunction_alt, \
    determiner, determiner_alt, \
    eomi, eomi_alt, \
    josa, josa_alt, \
    noun, noun_alt, \
    preEomi, preEomi_alt, \
    suffix, suffix_alt, \
    verb, verb_alt = misspell_all_data()

    # 2) make mis-spell contents
    result = chg_word(raw_text, adjective, adjective_alt)
    result = chg_word(result, adverb, adverb_alt)
    result = chg_word(result, conjunction, conjunction_alt)
    result = chg_word(result, determiner, determiner_alt)
    result = chg_word(result, eomi, eomi_alt)
    result = chg_word(result, josa, josa_alt)
    result = chg_word(result, noun, noun_alt)
    result = chg_word(result, preEomi, preEomi_alt)
    result = chg_word(result, suffix, suffix_alt)
    result = chg_word(result, verb, verb_alt)
    save_text_file(filename, result)
Пример #2
0
"""
어미
"""
from mkdg.utils.chgword import chg_word


def load_eomi():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load eomi data

    Returns: eomi dictionary, alternative list
    """
    eomi = misspell_single_data("eomi")
    alternative = {
        "습니다": "니다",
        "는데요": "는데",
    }
    return eomi, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    eomi, alt = load_eomi()
    result = chg_word(test, eomi, alt)
    print("Result: ", result)
Пример #3
0
def based_on_origin_word(filename, raw_text):
    """ based on origin word (data/misspell_origin.xlsx) """
    origin = load_origin()
    result = chg_word(raw_text, origin)
    save_text_file(filename, result)
Пример #4
0
"""선어말어미"""
from mkdg.utils.chgword import chg_word


def load_preEomi():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load preEomi data

    Returns: preEomi dictionary, alternative list
    """
    preEomi = misspell_single_data("preEomi")
    alternative = {
        "었": "있었",
        "엇": "있었",
    }
    return preEomi, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    preEomi, alt = load_preEomi()
    result = chg_word(test, preEomi)  # , alt)
    print("Result: ", result)
Пример #5
0
"""
동사
"""
from mkdg.utils.chgword import chg_word


def load_verb():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load verb data

    Returns: verb dictionary, alternative list
    """
    verb = misspell_single_data("verb")
    alternative = {}
    return verb, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]
    print("Origin: ", test)
    verb, alt = load_verb()
    result = chg_word(test, verb, alt)
    print("Result: ", result)
Пример #6
0
형용사
"""
from mkdg.utils.chgword import chg_word


def load_adjective():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load adjective data

    Returns: adjective dictionary, alternative list
    """
    adjective = misspell_single_data("adjective")
    alternative = {

    }
    return adjective, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.",
        "많은 연구원들이 좋아할 것 입니다.",
        "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    adjective, alt = load_adjective()
    result = chg_word(test, adjective)  # , alt)
    print("Result: ", result)
Пример #7
0
"""
관형사
"""
from mkdg.utils.chgword import chg_word


def load_determiner():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load determiner data

    Returns: determiner dictionary, alternative list
    """
    determiner = misspell_single_data("determiner")
    alternative = {
        "요런": "이런",
    }
    return determiner, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    determiner, alternative = load_determiner()
    result = chg_word(test, determiner)  # , alt)
    print("Result: ", result)
Пример #8
0
"""
접사
"""
from mkdg.utils.chgword import chg_word


def load_suffix():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load suffix data

    Returns: suffix dictionary, alternative list
    """
    suffix = misspell_single_data("suffix")
    alternative = {}
    return suffix, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    suffix, alt = load_suffix()
    result = chg_word(test, suffix)  # , alt)
    print("Result: ", result)
Пример #9
0
def load_conjunction():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load conjunction data

    Returns: conjunction dictionary, alternative list
    """
    conjunction = misspell_single_data("conjunction")
    alternative = {
        "그러면": "그럼",
        "그런데": "근데",
        "따라서": "그래서",
        "하지만": "그렇지만",
        "그러나": "그렇지만",
        "또는": "또",
    }

    return conjunction, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    conjunction, alt = load_conjunction()
    result = chg_word(test, conjunction, alt)
    print("Result: ", result)
Пример #10
0
"""
부사
"""
from mkdg.utils.chgword import chg_word


def load_adverb():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load adverb data

    Returns: adverb dictionary, alternative list
    """
    adverb = misspell_single_data("adverb")
    alternative = {}
    return adverb, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    adverb, alt = load_adverb()
    result = chg_word(test, adverb)  # , alt)
    print("Result: ", result)
Пример #11
0
"""
origin word.
komoran 형태소 분석기로 돌린 word값이 아닌,
순수 space 기준으로 나온 단어들
"""
from mkdg.utils.chgword import chg_word


def load_origin():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load origin word data

    Returns: origin word dictionary
    """
    origin = misspell_single_data()
    return origin


if __name__ == "__main__":
    test = [
        "이태원 클럽발 확진자가 늘어났다.",
        "빨리 사태가 진정되었으면 좋겠다",
    ]

    print("Origin: ", test)
    origin = load_origin()
    result = chg_word(test, origin)
    print("Result: ", result)
Пример #12
0
"""
명사
"""
from mkdg.utils.chgword import chg_word


def load_noun():
    from mkdg.utils.getmisspell import misspell_single_data
    """
    Load noun data

    Returns: noun dictionary, alternative list
    """
    noun = misspell_single_data("noun")
    alternative = {}
    return noun, alternative


if __name__ == "__main__":
    test = [
        "오늘 코로나에 걸린 사람이 줄었습니다.", "많은 연구원들이 좋아할 것 입니다.", "병원 관계자들 또한 좋아할 것입니다."
    ]

    print("Origin: ", test)
    noun, alt = load_noun()
    result = chg_word(test, noun)  # , alt)
    print("Result: ", result)