{"id":8483,"date":"2019-11-10T11:23:30","date_gmt":"2019-11-10T02:23:30","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=8483"},"modified":"2020-05-28T09:58:44","modified_gmt":"2020-05-28T00:58:44","slug":"%ed%8c%8c%ec%9d%b4%ec%8d%ac%ec%9d%98-nltk-%eb%9d%bc%ec%9d%b4%eb%b8%8c%eb%9f%ac%eb%a6%ac%eb%a5%bc-%ec%9d%b4%ec%9a%a9%ed%95%9c-wordnet-%ed%99%9c%ec%9a%a9","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=8483","title":{"rendered":"\ud30c\uc774\uc36c\uc758 NLTK \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc774\uc6a9\ud55c WordNet \ud65c\uc6a9"},"content":{"rendered":"<p>WordNet\uc740 \ud504\ub9b0\uc2a4\ud134 \ub300\ud559\uad50\uc5d0\uc11c \uad6c\ucd95\ud55c \uc720\uc758\uc5b4 DB\uc778\ub370, \uc720\uc758\uc5b4 \uc0ac\uc774\uc758 \uad00\uacc4\ub97c \uadf8\ub798\ud504\ub85c \uc815\uc758\ud558\uace0 \uc788\ub294 \ubc29\ub300\ud55c \ub370\uc774\ud130\uc785\ub2c8\ub2e4. \uc774 WordNet\uc744 \uc774\uc6a9\ud558\uc5ec \uc720\uc0ac\ud55c \ub2e8\uc5b4\ub97c \ud30c\uc545\ud560 \uc218 \uc788\uace0, \uac01 \ub2e8\uc5b4\uc758 \uc720\uc0ac\ub3c4\ub97c \uacc4\uc0b0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub97c \ud30c\uc774\uc36c\uc758 NLTK\ub97c \uc774\uc6a9\ud574 \ud65c\uc6a9\ud560 \uc218 \uc788\ub294\ub370, \uc774\uc5d0 \ub300\ud55c \ucf54\ub4dc\ub97c \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4.<\/p>\n<p>\uba3c\uc800 NLTK \ud328\ud0a4\uc9c0\uc758 \uc124\uce58\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc81c \ud658\uacbd\uc5d0\uc11c\ub294 conda install nltk\uc640 \uac19\uc740 \uc2dd\uc73c\ub85c \uc124\uce58\ud558\uc600\uc2b5\ub2c8\ub2e4.<\/p>\n<p>NLTK \ud328\ud0a4\uc9c0\uc758 \uc124\uce58\uac00 \ub05d\ub098\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \ucf54\ub4dc\ub97c \ud1b5\ud574 WordNet \ub370\uc774\ud130\ub97c PC\uc5d0 \ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nimport nltk\r\n\r\nnltk.download('wordnet')\r\n<\/pre>\n<p>\uac00\uc7a5\uba3c\uc800 &#8216;man&#8217;\uc774\ub77c\ub294 \ub2e8\uc5b4\uc758 \uc720\uc758\uc5b4\ub97c \uac80\uc0c9\ud558\uae30 \uc704\ud574 \ub2e4\uc74c \ucf54\ub4dc\uac00 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nfrom nltk.corpus import wordnet\r\n\r\nprint(wordnet.synsets('man'))\r\n''' Output:\r\n[\r\n    Synset('man.n.01'), \r\n    Synset('man.n.03'), \r\n    Synset('man.n.05'), \r\n    Synset('man.n.06'),     \r\n    Synset('man.n.08'), \r\n    Synset('man.n.09'), \r\n    Synset('man.n.10'), \r\n    Synset('man.v.01'), \r\n    Synset('man.v.02')],\r\n    Synset('serviceman.n.01'), \r\n    Synset('homo.n.02'), \r\n    Synset('valet.n.01'),     \r\n    Synset('world.n.08')\r\n]     \r\n'''\r\n<\/pre>\n<p>\uc704\uc758 \uac80\uc0c9\uc5d0\uc11c man.n.01\uc758 \uacbd\uc6b0 n\uc740 \uba85\uc0ac\ub97c \uc758\ubbf8\ud569\ub2c8\ub2e4. \ucc38\uace0\ub85c v\ub294 \ub3d9\uc0ac\uc774\uad6c\uc694. 01\uc740 man\uc5d0 \ub300\ud55c \uc778\ub371\uc2a4\uac12\uc785\ub2c8\ub2e4. \uc774 man.n.01\uc5d0 \ub300\ud55c \uc0ac\uc804\uc801 \uc758\ubbf8\ub97c \uc5bb\uae30 \uc704\ud55c \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nman = wordnet.synset('man.n.01')\r\nprint(man.definition()) # an adult person who is male (as opposed to a woman)\r\n<\/pre>\n<p>\ubc84\uadf8\uc778\uc9c0\ub294 \ubaa8\ub974\uaca0\uc73c\ub098, man.n.02\ub294 \uac80\uc0c9\ub418\uc9c0 \uc54a\uc558\uc74c\uc5d0\ub3c4 \uc544\ub798\uc758 \ucf54\ub4dc\ub294 \uc720\ud6a8\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nman2 = wordnet.synset('man.n.02')\r\nprint(man2.definition()) # someone who serves in the armed forces; a member of a military force\r\n<\/pre>\n<p>man.n.01\uc5d0 \ub300\ud55c \ub2e8\uc5b4\uc758 \uad00\uacc4 \uadf8\ub798\ud504\ub294 \ub2e4\uc74c \ucf54\ub4dc\ub97c \ud1b5\ud574 \uc5bb\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nprint(man.hypernym_paths())\r\n''' Output:\r\n[\r\n    [Synset('entity.n.01'), Synset('physical_entity.n.01'), Synset('causal_agent.n.01'), Synset('person.n.01'), Synset('adult.n.01'), Synset('man.n.01')], \r\n    [Synset('entity.n.01'), Synset('physical_entity.n.01'), Synset('object.n.01'), Synset('whole.n.02'), Synset('living_thing.n.01'), Synset('organism.n.01'), Synset('person.n.01'), Synset('adult.n.01'), Synset('man.n.01')], \r\n    [Synset('entity.n.01'), Synset('physical_entity.n.01'), Synset('causal_agent.n.01'), Synset('person.n.01'), Synset('male.n.02'), Synset('man.n.01')], \r\n    [Synset('entity.n.01'), Synset('physical_entity.n.01'), Synset('object.n.01'), Synset('whole.n.02'), Synset('living_thing.n.01'), Synset('organism.n.01'), Synset('person.n.01'), Synset('male.n.02'), Synset('man.n.01')]\r\n]\r\n'''\r\n<\/pre>\n<p>\uc704\uc758 \uad00\uacc4 \uadf8\ub798\ud504 \uc815\ubcf4\ub294 \ucd1d 4\uac1c\uc758 list\ub85c \uad6c\uc131\ub41c list\uc778\ub370, \uc774\ub97c \uc2dc\uac01\ud654\ud558\uba74 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2019\/11\/nltk.png\" alt=\"\" width=\"600\" class=\"aligncenter size-full wp-image-8484\" \/><\/p>\n<p>\uad00\uacc4 \uadf8\ub798\ud504\uc758 \uacbd\ub85c \uc5ed\uc2dc 4\uac1c\ub77c\ub294 \uac83\uc744 \uc54c \uc218 \uc788\uace0, \uacbd\ub85c\uc758 \ud750\ub984\uc5d0 \ub530\ub77c \ub2e8\uc5b4\uc758 \uc758\ubbf8\uac00 \uc810\uc810 \uad6c\uccb4\ud654\ub429\ub2c8\ub2e4. \uc774 \uad00\uacc4 \uadf8\ub798\ud504\ub97c \ud1b5\ud574 \uc11c\ub85c \ub2e4\ub978 \ub2e8\uc5b4\uc5d0 \ub300\ud55c \uc720\uc0ac\ub3c4\ub97c \uacc4\uc0b0\ud560 \uc218 \uc788\ub294\ub370, \uc544\ub798\uc758 \ucf54\ub4dc\uac00 \uadf8 \uc608\uc785\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nboy = wordnet.synset('boy.n.01')\r\nguy = wordnet.synset('guy.n.01')\r\ngirl = wordnet.synset('girl.n.01')\r\nwoman = wordnet.synset('woman.n.01')\r\n\r\nprint(man.path_similarity(man))     # 1.0\r\nprint(man.path_similarity(boy))     # 0.3333333333333333\r\nprint(man.path_similarity(guy))     # 0.5\r\nprint(man.path_similarity(girl))    # 0.25\r\nprint(man.path_similarity(woman))   # 0.3333333333333333\r\n<\/pre>\n<p>\ub2e8\uc5b4 \uac04\uc758 \uc720\uc0ac\ub3c4\ub294 0\ubd80\ud130 1\uae4c\uc9c0\uc758 \uac12\uc73c\ub85c, 1\uc5d0 \uac00\uae4c\uc6b8\uc218\ub85d \ub450 \ub2e8\uc5b4\uc758 \uc758\ubbf8\uac00 \ub354\uc6b1\ub354 \uc720\uc0ac\ud558\ub2e4\ub294 \uc758\ubbf8\uc774\uace0, 0\uc5d0 \uac00\uae4c\uc6b8\uc218\ub85d \uadf8 \uc758\ubbf8\uc758 \uad00\uacc4\uac00 \uac70\uc758 \uc5c6\ub2e4\ub294 \uac83\uc744 \uc758\ubbf8\ud569\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordNet\uc740 \ud504\ub9b0\uc2a4\ud134 \ub300\ud559\uad50\uc5d0\uc11c \uad6c\ucd95\ud55c \uc720\uc758\uc5b4 DB\uc778\ub370, \uc720\uc758\uc5b4 \uc0ac\uc774\uc758 \uad00\uacc4\ub97c \uadf8\ub798\ud504\ub85c \uc815\uc758\ud558\uace0 \uc788\ub294 \ubc29\ub300\ud55c \ub370\uc774\ud130\uc785\ub2c8\ub2e4. \uc774 WordNet\uc744 \uc774\uc6a9\ud558\uc5ec \uc720\uc0ac\ud55c \ub2e8\uc5b4\ub97c \ud30c\uc545\ud560 \uc218 \uc788\uace0, \uac01 \ub2e8\uc5b4\uc758 \uc720\uc0ac\ub3c4\ub97c \uacc4\uc0b0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub97c \ud30c\uc774\uc36c\uc758 NLTK\ub97c \uc774\uc6a9\ud574 \ud65c\uc6a9\ud560 \uc218 \uc788\ub294\ub370, \uc774\uc5d0 \ub300\ud55c \ucf54\ub4dc\ub97c \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4. \uba3c\uc800 NLTK \ud328\ud0a4\uc9c0\uc758 \uc124\uce58\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc81c \ud658\uacbd\uc5d0\uc11c\ub294 conda install nltk\uc640 \uac19\uc740 \uc2dd\uc73c\ub85c \uc124\uce58\ud558\uc600\uc2b5\ub2c8\ub2e4. NLTK \ud328\ud0a4\uc9c0\uc758 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=8483\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;\ud30c\uc774\uc36c\uc758 NLTK \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc774\uc6a9\ud55c WordNet \ud65c\uc6a9&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[132],"tags":[],"class_list":["post-8483","post","type-post","status-publish","format-standard","hentry","category-deep-machine-learning"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8483"}],"version-history":[{"count":6,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8483\/revisions"}],"predecessor-version":[{"id":9354,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8483\/revisions\/9354"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8483"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}