{"id":1339,"date":"2021-02-16T20:50:14","date_gmt":"2021-02-16T11:50:14","guid":{"rendered":"http:\/\/leenux.kr\/?p=1339"},"modified":"2021-02-22T06:00:54","modified_gmt":"2021-02-21T21:00:54","slug":"python-konlpy-%eb%9d%bc%ec%9d%b4%eb%b8%8c%eb%9f%ac%eb%a6%ac-%ec%95%8c%ec%95%84%eb%b3%b4%ea%b8%b0-%eb%b0%8f-%ec%8b%9c%ec%9e%91%ed%95%98%ea%b8%b0-%ec%84%a4%ec%b9%98","status":"publish","type":"post","link":"https:\/\/leenux.kr\/?p=1339","title":{"rendered":"[Python] KoNLPy \ud1a0\ud06c\ub098\uc774\uc9d5 \ub77c\uc774\ube0c\ub7ec\ub9ac \uc54c\uc544\ubcf4\uae30 \ubc0f \uc2dc\uc791\ud558\uae30 (\uc124\uce58)"},"content":{"rendered":"\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"> <strong>NoNLPy\ub294 \uae30\ubcf8\uc801\uc778 \ud55c\uad6d\uc5b4 \uc790\uc5f0\uc5b4 \ucc98\ub9ac\ub97c \uc704\ud55c \ud30c\uc774\uc36c \ub77c\uc774\ube0c\ub7ec\ub9ac\uc774\uace0 \uacf5\uc2dd \uc0ac\uc774\ud2b8\uc5d0 \ub530\ub974\uba74 \ucf54\uc5d4\uc5d8\ud30c\uc774\ub77c\uace0 \uc77d\ub294\ub2e4. KoNLPy\ub294 \uc624\ud508\uc18c\uc2a4 \uc18c\ud504\ud2b8\uc6e8\uc5b4\uc774\uba70, GPL v3 \ub77c\uc774\uc13c\uc2a4\uc5d0 \ub530\ub77c \uc790\uc720\ub86d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc5b4 \ud55c\uad6d\uc5b4 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \ubd84\uc57c\uc5d0\uc11c \ub9ce\uc774 \uc0ac\uc6a9\ud558\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc774\ub2e4.<\/strong><\/p>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>NLP (Natural Language Processing, \uc790\uc5f0\uc5b4\ucc98\ub9ac)\ub294 \ud14d\uc2a4\ud2b8\uc5d0\uc11c \uc758\ubbf8\uc788\ub294 \uc815\ubcf4\ub97c \ubd84\uc11d, \ucd94\ucd9c\ud558\uace0 \uc774\ud574\ud558\ub294 \uc77c\ub828\uc758 \uae30\uc220\uc9d1\ud569\uc774\ub2e4.<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/konlpy-ko.readthedocs.io\/ko\/v0.4.3\/start\/\">\ucd9c\ucc98 https:\/\/konlpy-ko.readthedocs.io\/ko\/v0.4.3\/start\/<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p class=\"has-text-color has-large-font-size has-very-dark-gray-color\"><strong>install<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/konlpy-ko.readthedocs.io\/ko\/v0.4.3\/install\/#id1\">\uacf5\uc2dd\ud648\ud398\uc774\uc9c0\ub2e4\uc6b4\ub85c\ub4dc<\/a><\/p>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>Mac OS<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip install konlpy     # Python 2.x\n$ pip3 install konlpy    # Python 3.x<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$ bash &lt;(curl -s https:\/\/raw.githubusercontent.com\/konlpy\/konlpy\/master\/scripts\/mecab.sh)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>Kkma \ubaa8\ub4c8 \uc0ac\uc6a9\ud558\uae30<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from konlpy.tag import Kkma\nfrom konlpy.utils import pprint\n\nif __name__ == '__main__':\n    kkma = Kkma()\n    message = '\uc548\ub155\ud558\uc138\uc694 \uc800\ub294 \ud64d\uae38\ub3d9\uc785\ub2c8\ub2e4.'\n    hello = \"\uc548\ub155\ud558\uc138\uc694. \uc800\ub294 \ud64d\uae38\ub3d9\uc774\uba70 \uace0\ub4f1\ud559\uad50 3\ud559\ub144\uc785\ub2c8\ub2e4. \uc624\ub298 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \uacf5\ubd80\ub97c \uc2dc\uc791\ud55c \ud559\uc0dd\uc774\uba70 \uc55e\uc73c\ub85c \uc571\uc5d0 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \uae30\uc220\uc744 \uc751\uc6a9\ud558\uba70 \uac1c\ubc1c\uc744 \uc9c4\ud589\ud560 \uc608\uc815\uc785\ub2c8\ub2e4. \uc55e\uc73c\ub85c \ub9ce\uc740 \uad00\uc2ec\uacfc \uc751\uc6d0 \ubd80\ud0c1\ub4dc\ub9bd\ub2c8\ub2e4. \uac10\uc0ac\ud569\ub2c8\ub2e4.\"\n\n    # \ud615\ud0dc\uc18c \ucd94\ucd9c\n    pprint(\"morphs : \" + str(kkma.morphs(message)))\n\n    # \ud615\ud0dc\uc18c\uc640 \ud488\uc0ac \ud0dc\uadf8 \ucd94\ucd9c\n    pprint(\"nouns : \" + str(kkma.nouns(message)))\n\n    # \uba85\uc0ac\ub9cc \ucd94\ucd9c\n    pprint(\"pos : \" + str(kkma.pos(message)))\n\n    # \ubb38\uc7a5 \ubd84\ub9ac\n    sentences = kkma.sentences(hello)\n    pprint(\"sentences : \" + str(sentences))\n    for i in sentences:\n        print(i)<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>\uacb0\uacfc<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"morphs : ['\uc548\ub155', '\ud558', '\uc138\uc694', '\uc800', '\ub294', '\ud64d\uae38\ub3d9', '\uc774', '\u3142\ub2c8\ub2e4', '.']\"\n\"nouns : ['\uc548\ub155', '\uc800', '\ud64d\uae38\ub3d9']\"\n(\"pos : [('\uc548\ub155', 'NNG'), ('\ud558', 'XSV'), ('\uc138\uc694', 'EFN'), ('\uc800', 'NP'), ('\ub294', 'JX'), \"\n \"('\ud64d\uae38\ub3d9', 'NNG'), ('\uc774', 'VCP'), ('\u3142\ub2c8\ub2e4', 'EFN'), ('.', 'SF')]\")\n(\"sentences : ['\uc548\ub155\ud558\uc138\uc694.', '\uc800\ub294 \ud64d\uae38\ub3d9\uc774\uba70 \uace0\ub4f1\ud559\uad50 3 \ud559\ub144\uc785\ub2c8\ub2e4.', '\uc624\ub298 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \uacf5\ubd80\ub97c \uc2dc\uc791\ud55c \ud559\uc0dd\uc774\uba70 \uc55e\uc73c\ub85c \"\n \"\uc571\uc5d0 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \uae30\uc220\uc744 \uc751\uc6a9\ud558\uba70 \uac1c\ubc1c\uc744 \uc9c4\ud589\ud560 \uc608\uc815\uc785\ub2c8\ub2e4.', '\uc55e\uc73c\ub85c \ub9ce\uc740 \uad00\uc2ec\uacfc \uc751\uc6d0 \ubd80\ud0c1 \ub4dc\ub9bd\ub2c8\ub2e4.', '\uac10\uc0ac\ud569\ub2c8\ub2e4.']\")\n\uc548\ub155\ud558\uc138\uc694.\n\uc800\ub294 \ud64d\uae38\ub3d9\uc774\uba70 \uace0\ub4f1\ud559\uad50 3 \ud559\ub144\uc785\ub2c8\ub2e4.\n\uc624\ub298 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \uacf5\ubd80\ub97c \uc2dc\uc791\ud55c \ud559\uc0dd\uc774\uba70 \uc55e\uc73c\ub85c \uc571\uc5d0 \uc790\uc5f0\uc5b4 \ucc98\ub9ac \uae30\uc220\uc744 \uc751\uc6a9\ud558\uba70 \uac1c\ubc1c\uc744 \uc9c4\ud589\ud560 \uc608\uc815\uc785\ub2c8\ub2e4.\n\uc55e\uc73c\ub85c \ub9ce\uc740 \uad00\uc2ec\uacfc \uc751\uc6d0 \ubd80\ud0c1 \ub4dc\ub9bd\ub2c8\ub2e4.\n\uac10\uc0ac\ud569\ub2c8\ub2e4.\n\nProcess finished with exit code 0<\/code><\/pre>\n\n\n\n<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-color:#9ABAD9;border-spacing:0;}\n.tg td{background-color:#EBF5FF;border-color:#9ABAD9;border-style:solid;border-width:1px;color:#444;\n  font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{background-color:#409cff;border-color:#9ABAD9;border-style:solid;border-width:1px;color:#fff;\n  font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-wrg0{font-size:22px;text-align:center;vertical-align:top}\n.tg .tg-9d8n{border-color:inherit;font-size:22px;text-align:center;vertical-align:top}\n<\/style>\n<table class=\"tg\">\n<thead>\n  <tr>\n    <th class=\"tg-x1hj\">\ud488\uc0ac<\/th>\n    <th class=\"tg-wrg0\">\uc124\uba85<\/th>\n  <\/tr>\n<\/thead>\n<tbody>\n  <tr>\n    <td class=\"tg-cyim\">NNG<\/td>\n    <td class=\"tg-wrg0\">\uc77c\ubc18 \uba85\uc0ac<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-cyim\">JKS<\/td>\n    <td class=\"tg-wrg0\">\uc8fc\uaca9 \uc870\uc0ac<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-cyim\">JKM<\/td>\n    <td class=\"tg-wrg0\">\ubd80\uc0ac\uaca9 \uc870\uc0ac<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-cyim\">VV<\/td>\n    <td class=\"tg-wrg0\">\ub3d9\uc0ac<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-cyim\">EFN<\/td>\n    <td class=\"tg-wrg0\">\ud3c9\uc11c\ud615 \uc885\uacb0 \uc5b4\ubbf8<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-cyim\">SF<\/td>\n    <td class=\"tg-wrg0\">\ub9c8\uce68\ud45c, \ubb3c\uc74c\ud45c, \ub290\ub08c\ud45c<\/td>\n  <\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>Kkma\ub294 \ucd1d 56\uac1c\uc758 \ud488\uc0ac \ud0dc\uadf8\ub97c \uc9c0\uc6d0\ud558\uace0 \uc788\ub2e4.<\/strong><\/p>\n\n\n\n<p><a href=\"http:\/\/kkma.snu.ac.kr\/documents\/?doc=postag\">http:\/\/kkma.snu.ac.kr\/documents\/?doc=postag<\/a> \ucc38\uace0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Python] KoNLPy \ud1a0\ud06c\ub098\uc774\uc9d5 \ub77c\uc774\ube0c\ub7ec\ub9ac \uc54c\uc544\ubcf4\uae30 \ubc0f \uc2dc\uc791\ud558\uae30 (\uc124\uce58)<\/p>\n","protected":false},"author":1,"featured_media":1361,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1339"}],"collection":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1339"}],"version-history":[{"count":10,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1339\/revisions"}],"predecessor-version":[{"id":1363,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1339\/revisions\/1363"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/media\/1361"}],"wp:attachment":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}