본문 바로가기

반응형

전체 글

(291)
토픽 모델링으로 주제 찾기 (5) 7.4 토픽 트렌드로 시간에 따른 주제의 변화 알아내기 !pip install wget import os import wget import ssl data_dir = 'data' url = 'https://s3.ap-northeast-2.amazonaws.com/data10902/petition/petition_sampled.csv' ssl._create_default_https_context = ssl._create_unverified_context if not os.path.exists(data_dir): os.mkdir(data_dir) wget.download(url, data_dir) """ /usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel..
토픽 모델링으로 주제 찾기 (4) 7.3 Gensim을 이용한 토픽 모델링 7.3.2 혼란도와 토픽 응집도를 이용한 최적값 선택 from gensim.models import CoherenceModel cm = CoherenceModel(model=model, corpus=corpus, coherence='u_mass') coherence = cm.get_coherence() print(coherence) """ /usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the re..
토픽 모델링으로 주제 찾기 (3) 7.3 Gensim을 이용한 토픽 모델링 7.3.1 Gensim 사용법과 시각화 Gensim: 토픽 모델링을 비롯해 의미적인 자연어 처리를 위한 다양한 라이브러리 !pip install --upgrade gensim import nltk nltk.download('stopwords') """ [nltk_data] Downloading package stopwords to /root/nltk_data... [nltk_data] Unzipping corpora/stopwords.zip. True """ # 필요한 library들을 import from nltk.corpus import stopwords from nltk.tokenize import RegexpTokenizer cachedStopWords =..

반응형