{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Sentiment Analysis - Restaurant Reviews.ipynb", "provenance": [], "collapsed_sections": [], "toc_visible": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "code", "metadata": { "id": "kh4udnC9fZyU", "colab_type": "code", "outputId": "677fbeb5-d5b2-49f7-99bf-92bd1f2fa44e", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ "# Connecting Google Drive with Google Colab\n", "from google.colab import drive\n", "drive.mount('/content/drive/')" ], "execution_count": 1, "outputs": [ { "output_type": "stream", "text": [ "Drive already mounted at /content/drive/; to attempt to forcibly remount, call drive.mount(\"/content/drive/\", force_remount=True).\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "id": "wqtOguIVfysM", "colab_type": "code", "colab": {} }, "source": [ "# Importing essential libraries\n", "import numpy as np\n", "import pandas as pd" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "FsZFCtjijekC", "colab_type": "code", "colab": {} }, "source": [ "# Loading the dataset\n", "df = pd.read_csv('/content/drive/My Drive/Colab Notebooks/Datasets/Restaurant_Reviews.tsv', delimiter='\\t', quoting=3)" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "zkdfWSlej05y", "colab_type": "code", "outputId": "26f108a7-5617-4abe-efae-0d64d31e8041", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ "df.shape" ], "execution_count": 4, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "(1000, 2)" ] }, "metadata": { "tags": [] }, "execution_count": 4 } ] }, { "cell_type": "code", "metadata": { "id": "SyYImhASubeb", "colab_type": "code", "outputId": "2c8efdb6-17a5-48da-8ac2-7c9d2c289b09", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ "df.columns" ], "execution_count": 5, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "Index(['Review', 'Liked'], dtype='object')" ] }, "metadata": { "tags": [] }, "execution_count": 5 } ] }, { "cell_type": "code", "metadata": { "id": "b5lzlG5DMNX9", "colab_type": "code", "outputId": "ab125608-7f10-479c-8dab-bb298fa7bbaf", "colab": { "base_uri": "https://localhost:8080/", "height": 197 } }, "source": [ "df.head()" ], "execution_count": 6, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "
\n", " | Review | \n", "Liked | \n", "
---|---|---|
0 | \n", "Wow... Loved this place. | \n", "1 | \n", "
1 | \n", "Crust is not good. | \n", "0 | \n", "
2 | \n", "Not tasty and the texture was just nasty. | \n", "0 | \n", "
3 | \n", "Stopped by during the late May bank holiday of... | \n", "1 | \n", "
4 | \n", "The selection on the menu was great and so wer... | \n", "1 | \n", "