[Konlpy관련 질문] komoran과 kkma api 사용 차이점??

392 views
Skip to first unread message

NathanPark

unread,
Jun 15, 2015, 12:39:38 AM6/15/15
to kon...@googlegroups.com

안녕하세요.

Konlpy 사용하다 질문이 있습니다.

 

실행환경은 Ipython으로 실행하였으며

testfileMysql에서 긁어 온 데이터를 txt로 만든 다음 txt파일을 긁어오는 형식입니다.

궁금한 점은 kkma를 쓰면 너무 자세히 나오는 것 같아

다른 형태소 분석기인 komoran등을 사용하다 나온 에러가 궁금하여 올립니다.

Python을 처음써보지만.. 답변주시면 감사하겠습니다~!

image001.jpg

Eunjeong Lucy Park

unread,
Jun 15, 2015, 2:49:41 AM6/15/15
to NathanPark, kon...@googlegroups.com
안녕하세요.

올려주신 캡쳐 이미지가 해상도가 낮아 잘 보이지는 않습니다만, 105번째(103번째?) 줄에서 f = s.decode('UTF-8') 으로 적은 부분이 문제인듯합니다.

문서를 읽기 위해서는 아래와 같이 실행해보시기 바랍니다.

from konlpy.tag import Komoran
from konlpy.utils import pprint

komoran = Komoran()

with open('filename.txt', 'r') as f:   # filename.txt를 열어 f라고 하자
     s = f.read().decode('utf-8')       # f를 읽고 utf-8로 디코딩한 결과를 s라 하자
pprint(komoran.pos(s))                 # s를 komoran으로 pos tagging한 후 pprint하자


감사합니다.

박은정 드림

--
박은정 (Eunjeong Lucy Park)
Ph.D. Candidate @ Data Mining Lab, Seoul National University
"배워서 남 주자 (Learning to Give)"

--
이 메일은 Google 그룹스 'KoNLPy' 그룹에 가입한 분들에게 전송되는 메시지입니다.
이 그룹에서 탈퇴하고 더 이상 이메일을 받지 않으려면 konlpy+un...@googlegroups.com에 이메일을 보내세요.
이 그룹에 게시하려면 kon...@googlegroups.com에 이메일을 보내세요.
웹에서 이 토론을 보려면 https://groups.google.com/d/msgid/konlpy/000901d0a725%2448e80c60%24dab82520%24%40gmail.com을(를) 방문하세요.
더 많은 옵션을 보려면 https://groups.google.com/d/optout을(를) 방문하세요.

Reply all
Reply to author
Forward
0 new messages