{"id":448,"date":"2016-09-10T12:54:17","date_gmt":"2016-09-10T03:54:17","guid":{"rendered":"https:\/\/posuer000.wordpress.com\/?p=448"},"modified":"2016-09-10T12:55:03","modified_gmt":"2016-09-10T03:55:03","slug":"using-stanford-pos-tagger","status":"publish","type":"post","link":"https:\/\/www.wanggengyu.com\/?p=448","title":{"rendered":"Using Stanford POS tagger in NLTK"},"content":{"rendered":"<p>Add enviroment variable first:<br \/>\n<code><br \/>\nexport CLASSPATH=dir\/stanford-postagger-full-2015-04-20\/stanford-postagger.jar<\/p>\n<p>export STANFORD_MODELS=dir\/stanford-postagger-full-2015-04-20\/models<br \/>\n<\/code><br \/>\nhttp:\/\/stackoverflow.com\/questions\/13883277\/stanford-parser-and-nltk\/34112695#34112695<\/p>\n<p><code><br \/>\n&gt;&gt;&gt; from nltk.tag import StanfordPOSTagger<br \/>\n&gt;&gt;&gt; st = StanfordPOSTagger('english-bidirectional-distsim.tagger')<br \/>\n&gt;&gt;&gt; st.tag('What is the airspeed of an unladen swallow ?'.split())<br \/>\n[('What', 'WP'), ('is', 'VBZ'), ('the', 'DT'), ('airspeed', 'NN'), ('of', 'IN'), ('an', 'DT'), ('unladen', 'JJ'), ('swallow', 'VB'), ('?', '.')]<br \/>\n<\/code><br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add enviroment variable first: export CLASSPATH=dir\/stanford-postagger-full-2015-04-20\/stanford-postagger.jar export STANFORD_MODELS=dir\/stanford-postagger-full-2015-04-20\/models http:\/\/stackoverflow.com\/questions\/13883277\/stanford-parser-and-nltk\/34112695#34112695 &gt;&gt;&gt; from nltk.tag import StanfordPOSTagger &gt;&gt;&gt; st = StanfordPOSTagger(&#8216;english-bidirectional-distsim.tagger&#8217;) &gt;&gt;&gt; st.tag(&#8216;What is the airspeed of an unladen swallow ?&#8217;.split()) [(&#8216;What&#8217;, &#8216;WP&#8217;), (&#8216;is&#8217;, &#8216;VBZ&#8217;), (&#8216;the&#8217;, &#8216;DT&#8217;), (&#8216;airspeed&#8217;, &#8216;NN&#8217;), (&#8216;of&#8217;, &#8216;IN&#8217;), (&#8216;an&#8217;, &#8216;DT&#8217;), (&#8216;unladen&#8217;, &#8216;JJ&#8217;), (&#8216;swallow&#8217;, &#8216;VB&#8217;), (&#8216;?&#8217;, &#8216;.&#8217;)] &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-448","post","type-post","status-publish","format-standard","hentry","category-techniques"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=\/wp\/v2\/posts\/448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=448"}],"version-history":[{"count":0,"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=\/wp\/v2\/posts\/448\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wanggengyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}