{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "execution": { "iopub.execute_input": "2023-02-28T09:01:35.199038Z", "iopub.status.busy": "2023-02-28T09:01:35.198153Z", "iopub.status.idle": "2023-02-28T09:01:35.214562Z", "shell.execute_reply": "2023-02-28T09:01:35.213234Z", "shell.execute_reply.started": "2023-02-28T09:01:35.198993Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/input/imdb-dataset-of-50k-movie-reviews/IMDB Dataset.csv\n" ] } ], "source": [ "# This Python 3 environment comes with many helpful analytics libraries installed\n", "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n", "# For example, here's several helpful packages to load\n", "\n", "import numpy as np # linear algebra\n", "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n", "\n", "# Input data files are available in the read-only \"../input/\" directory\n", "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n", "\n", "import os\n", "for dirname, _, filenames in os.walk('/kaggle/input'):\n", " for filename in filenames:\n", " print(os.path.join(dirname, filename))\n", "\n", "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n", "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2023-02-28T09:01:37.498012Z", "iopub.status.busy": "2023-02-28T09:01:37.497070Z", "iopub.status.idle": "2023-02-28T09:01:37.502150Z", "shell.execute_reply": "2023-02-28T09:01:37.501011Z", "shell.execute_reply.started": "2023-02-28T09:01:37.497972Z" } }, "outputs": [], "source": [ "import re # Regular expression" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Data Accqasation\n", "This notebook will do basic IMDB reviews sentiment analysis. As show in below image, we will be performing few text cleaning and model building techniques. The flow of the notebook." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2023-02-28T09:01:40.837603Z", "iopub.status.busy": "2023-02-28T09:01:40.836859Z", "iopub.status.idle": "2023-02-28T09:01:42.179878Z", "shell.execute_reply": "2023-02-28T09:01:42.178776Z", "shell.execute_reply.started": "2023-02-28T09:01:40.837558Z" } }, "outputs": [ { "data": { "text/html": [ "
| \n", " | review | \n", "sentiment | \n", "
|---|---|---|
| 0 | \n", "One of the other reviewers has mentioned that ... | \n", "positive | \n", "
| 1 | \n", "A wonderful little production. <br /><br />The... | \n", "positive | \n", "
| 2 | \n", "I thought this was a wonderful way to spend ti... | \n", "positive | \n", "
| 3 | \n", "Basically there's a family where a little boy ... | \n", "negative | \n", "
| 4 | \n", "Petter Mattei's \"Love in the Time of Money\" is... | \n", "positive | \n", "