본문 바로가기

반응형

전체 글

(291)
BOW 기반의 문서 분류 (7) 5.8 한국어 문서의 분류 5.8.1 다음 영화 리뷰에 대한 영화 제목 예 import pandas as pd df = pd.read_csv('/content/daum_movie_review.csv') df.head(5) df.title.value_counts() """ 신과함께 4947 택시운전사 2322 인피니티 워 2042 범죄도시 1939 곤지암 1547 라라랜드 1150 코코 778 Name: title, dtype: int64 """ from sklearn.model_selection import train_test_split # split data and labels into a training and a test set X_train, X_test, y_train, y_test = trai..
BOW 기반의 문서 분류 (6) 5.7 카운트 기반의 문제점과 N-gram을 이용한 보완 5.7.1 통계로는 알 수 없는 문맥 정보 BOW는 단어들이 쓰여진 순서에 따른 문맥 정보를 이용할 수 없음 BOW는 단어들의 순서를 무시하고, 단어가 사용된 횟수를 기반으로 문서에 대한 벡터 만듬 5.7.2 N-gram의 이해 N-gram: n개의 연속적인 단어들의 나열 하나의 토큰이 두개 이상의 단어로 구성될 수 있음 5.7.3 N-gram을 이용한 문서 분류 from nltk.corpus import stopwords from sklearn.feature_extraction.text import TfidfVectorizer from nltk.corpus import stopwords cachedStopWords = stopwords.words..
BOW 기반의 문서 분류 (5) 5.6 성능을 높이는 방법 import nltk nltk.download('stopwords') nltk.download('stopwords', quiet=True) # Download stopwords without the graphical interface """ [nltk_data] Downloading package stopwords to /root/nltk_data... [nltk_data] Package stopwords is already up-to-date! True """ # 필요한 library들을 import from nltk.corpus import stopwords cachedStopWords = stopwords.words("english") from nltk.tokenize i..

반응형