Skip to content

Instantly share code, notes, and snippets.

@j-min
Last active October 12, 2016 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-min/fd7f3bab0d35ef82ade05ce965fb75eb to your computer and use it in GitHub Desktop.
Save j-min/fd7f3bab0d35ef82ade05ce965fb75eb to your computer and use it in GitHub Desktop.
Mecab-ko based POS tagging iterator
from konlpy.tag import Mecab
mecab = Mecab()
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def mecab_pos_tag():
while True:
a = raw_input()
for x in mecab.pos(a):
print x[0].encode('utf-8').decode('utf-8'), x[1]
if __name__ == '__main__':
mecab_pos_tag()
@j-min
Copy link
Author

j-min commented Oct 12, 2016

Ex)
python Mecab-ko-iter.py
대출 신청했는데 감감무소식이라서요
대출 NNG
신청 NNG
했 XSV+EP
는데 EC
감감무소식 NNG
이 VCP
라서요 EC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment