Using Stanford POS tagger in NLTK

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


>>> from nltk.tag import StanfordPOSTagger
>>> st = StanfordPOSTagger('english-bidirectional-distsim.tagger')
>>> st.tag('What is the airspeed of an unladen swallow ?'.split())
[('What', 'WP'), ('is', 'VBZ'), ('the', 'DT'), ('airspeed', 'NN'), ('of', 'IN'), ('an', 'DT'), ('unladen', 'JJ'), ('swallow', 'VB'), ('?', '.')]

 

Previous Post

B-Spline Surface Implementation with OpenGL

In this implementation, instead of using any B-Spline built-in functions ... Read more

Next Post

你的生活就会变得完全不一样 ——《ビリギャル》观感

这两天见到朋友都会推荐《垫底辣妹》这部电影,我感觉身边小伙伴们都值得看一看~ 豆瓣页面   这个电影名称实在让人想吐槽,但是貌似大陆官方翻译就是这样。 对比一下香港的翻译:奇跡補習社 还有韩国的翻译:불량소녀, 너를응원해! (不良少女,为你加油!)   看完《垫底辣妹》,心情其实是矛盾的。 ... Read more

Leave a Reply