{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-10-08T10:32:08.453724Z", "iopub.status.busy": "2021-10-08T10:32:08.453019Z", "iopub.status.idle": "2021-10-08T10:32:08.853872Z", "shell.execute_reply": "2021-10-08T10:32:08.853141Z" } }, "outputs": [], "source": [ "import konlpy\n", "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "최신 `tweepy`를 설치할 경우 `StreamListener`가 없다는 에러가 발생(https://github.com/tweepy/tweepy/issues/1531) 하므로 3.10버전을 설치해 주세요.\n", "\n", "`pip install tweepy==3.10`" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-10-08T10:32:08.863731Z", "iopub.status.busy": "2021-10-08T10:32:08.863002Z", "iopub.status.idle": "2021-10-08T10:32:08.867959Z", "shell.execute_reply": "2021-10-08T10:32:08.868405Z" } }, "outputs": [ { "data": { "text/plain": [ "'0.5.2'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "konlpy.__version__" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "데이터 파일을 읽어 리뷰 텍스트와 점수를 text_train, y_train 변수에 저장합니다. 데이터 파일의 내용은 번호, 텍스트, 레이블이 탭으로 구분되어 한 라인에 한개의 데이터 샘플이 들어 있습니다." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2021-10-08T10:32:08.873456Z", "iopub.status.busy": "2021-10-08T10:32:08.872857Z", "iopub.status.idle": "2021-10-08T10:32:09.230697Z", "shell.execute_reply": "2021-10-08T10:32:09.231143Z" } }, "outputs": [], "source": [ "df_train = pd.read_csv('data/ratings_train.txt', delimiter='\\t', keep_default_na=False)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-10-08T10:32:09.237497Z", "iopub.status.busy": "2021-10-08T10:32:09.235262Z", "iopub.status.idle": "2021-10-08T10:32:09.241693Z", "shell.execute_reply": "2021-10-08T10:32:09.242122Z" }, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", " | id | \n", "document | \n", "label | \n", "
---|---|---|---|
0 | \n", "9976970 | \n", "아 더빙.. 진짜 짜증나네요 목소리 | \n", "0 | \n", "
1 | \n", "3819312 | \n", "흠...포스터보고 초딩영화줄....오버연기조차 가볍지 않구나 | \n", "1 | \n", "
2 | \n", "10265843 | \n", "너무재밓었다그래서보는것을추천한다 | \n", "0 | \n", "
3 | \n", "9045019 | \n", "교도소 이야기구먼 ..솔직히 재미는 없다..평점 조정 | \n", "0 | \n", "
4 | \n", "6483659 | \n", "사이몬페그의 익살스런 연기가 돋보였던 영화!스파이더맨에서 늙어보이기만 했던 커스틴 ... | \n", "1 | \n", "