👨🏻‍🏫IT 활동

    [NLP] Day 15 - Lexicon

    Lexicon문서표현, Lexicon dictonary의 token이 해당문서에 있으면 1, 없으면 0으로 표현된 리스트In [1]:from konlpy.corpus import kobill def getLexicon(): lexicon = list() for docName in kobill.fileids(): document = kobill.open(docName).read() for token in document.split(): if token not in lexicon: lexicon.append(token) return lexicon In [2]:%timeit getLexicon() 108 ms ± 1.4 ms per loop (mean ± std. dev. of 7 runs, 10 loops ..

    [NLP] Day 14 - Phrase

    PhraseIn [1]:sentence = "The little bear saw the fat trout in the book" In [100]:import nltk from nltk.tokenize import word_tokenize from nltk import pos_tag In [6]:tagged = pos_tag(word_tokenize(sentence)) In [7]:tagged # 리스트 속 튜플 Out[7]:[('The', 'DT'), ('little', 'JJ'), ('bear', 'NN'), ('saw', 'VBD'), ('the', 'DT'), ('fat', 'JJ'), ('trout', 'NN'), ('in', 'IN'), ('the', 'DT'), ('book', 'NN')]In..

    [NLP] Day 13 - POS Taggers

    POS ( Part Of Speech )In [9]:import re from string import punctuation from nltk.tokenize import word_tokenize sentence = "She sells seashells on the seashore." # tokens = word_tokenize(sentence) pattern = re.compile(r"[{0}]".format(re.escape(punctuation))) sentence = pattern.sub("",sentence) tokens = word_tokenize(sentence) result=[] for token in tokens: if pattern.search(token): print(token) el..

    [NLP] Day 12 - Normalization

    Normalization이전에 저번 시간에 못했던,Empirical Law크게 두 가지 법칙 !Zipf's Law경험에서 나온 법칙이다.단어의 빈도는 rank와 반비례한다. 1번 단어가 많이 나오면 2번은 앞 단어의 절반이다. ~~ In [59]:from matplotlib import font_manager, rc path='/Library/Fonts/AppleGothic.ttf' family = font_manager.FontProperties(fname=path).get_name() rc('font' ,family=family) In [69]:from nltk.corpus import gutenberg from konlpy.corpus import kolaw from nltk import Text ..

    [NLP] Day 11 - Preprocessing 2

    Preprocessing 2¶In [1]:import nltk In [3]:from nltk.corpus import gutenberg corpus = gutenberg.open(gutenberg.fileids()[0]).read() In [4]:from nltk.tokenize import sent_tokenize, word_tokenize len(corpus.splitlines()), len(sent_tokenize(corpus)), len(word_tokenize(corpus)) # 문장과 어휘의 개수. Out[4]:(16823, 7493, 191785)In [5]:from nltk import Text # Token을 기반으로 정보를 담기 위한 인스턴스이다. tokens = word_tokeniz..

    [NLP] Day 10 - Preprocessing

    Preprocessing본격적인 자연어 처리!형태소 분석 ( Stemming ) :제일 첫 단계토큰 분리, 어간 추출(ngram, 말의 중심어를 찾을 수 있음), 품사 부착, 색인(특정 단어가 몇 번 나왔는지), 벡터화(이해하기 쉽고, 연산하기 좋음)구문 분석 :문장 경계 인식, 구문분석, 공기어(A,B단어가 관련이 있는데 멀리 있어서, 쌍으로 인식), 개체명 사전 구축, 개체명 인식의미 분석 :지금 잘 안되는 분야!대용어 해소(대명사, 두문자어, 약어, 수치), 의미 중의성 해결 ( 동명이인, 이명동인 )담론 분석 :분류, 군집, 중복, 요약, 가중치, 순위화, 토픽 모델링, 이슈 트래킹, 평판 분석, 감성 분석, 복합논증분석쪼개면서 분석해가는 것 ! ( 담화 -> 문장 -> 어절 -> 단어 )KoNL..