{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[nltk_data] Downloading package stopwords to\n",
      "[nltk_data]     C:\\Users\\Maren\\AppData\\Roaming\\nltk_data...\n",
      "[nltk_data]   Unzipping corpora\\stopwords.zip.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import nltk\n",
    "nltk.download('stopwords')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "table = pd.read_csv(\"emoji_descriptions.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "
\n",
       "\n",
       "
\n",
       "  \n",
       "    \n",
       "       | \n",
       "      Unnamed: 0 | \n",
       "      code | \n",
       "      character | \n",
       "      description | \n",
       "      Unnamed: 4 | \n",
       "    
\n",
       "  \n",
       "  \n",
       "    \n",
       "      | 0 | \n",
       "      0 | \n",
       "      126980 | \n",
       "      ๐ | \n",
       "      MAHJONG TILE RED DRAGON | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 1 | \n",
       "      1 | \n",
       "      129525 | \n",
       "      ๐งต | \n",
       "      SPOOL OF THREAD | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 2 | \n",
       "      2 | \n",
       "      129526 | \n",
       "      ๐งถ | \n",
       "      BALL OF YARN | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 3 | \n",
       "      3 | \n",
       "      127183 | \n",
       "      ๐ | \n",
       "      PLAYING CARD BLACK JOKER | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 4 | \n",
       "      4 | \n",
       "      129296 | \n",
       "      ๐ค | \n",
       "      ZIPPER-MOUTH FACE | \n",
       "      NaN | \n",
       "    
\n",
       "  \n",
       "
\n",
       "
 "
      ],
      "text/plain": [
       "   Unnamed: 0    code character               description  Unnamed: 4\n",
       "0           0  126980         ๐   MAHJONG TILE RED DRAGON         NaN\n",
       "1           1  129525         ๐งต           SPOOL OF THREAD         NaN\n",
       "2           2  129526         ๐งถ              BALL OF YARN         NaN\n",
       "3           3  127183         ๐  PLAYING CARD BLACK JOKER         NaN\n",
       "4           4  129296         ๐ค         ZIPPER-MOUTH FACE         NaN"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Maren\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:5: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \"\"\"\n",
      "C:\\Users\\Maren\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:10: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  # Remove the CWD from sys.path while we load stuff.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "
\n",
       "  \n",
       "    \n",
       "       | \n",
       "      Unnamed: 0 | \n",
       "      code | \n",
       "      character | \n",
       "      description | \n",
       "      Unnamed: 4 | \n",
       "    
\n",
       "  \n",
       "  \n",
       "    \n",
       "      | 0 | \n",
       "      0 | \n",
       "      126980 | \n",
       "      ๐ | \n",
       "      mahjong tile red dragon | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 1 | \n",
       "      1 | \n",
       "      129525 | \n",
       "      ๐งต | \n",
       "      spool thread | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 2 | \n",
       "      2 | \n",
       "      129526 | \n",
       "      ๐งถ | \n",
       "      ball yarn | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 3 | \n",
       "      3 | \n",
       "      127183 | \n",
       "      ๐ | \n",
       "      playing card black joker | \n",
       "      NaN | \n",
       "    
\n",
       "    \n",
       "      | 4 | \n",
       "      4 | \n",
       "      129296 | \n",
       "      ๐ค | \n",
       "      zipper-mouth face | \n",
       "      NaN | \n",
       "    
\n",
       "  \n",
       "
\n",
       "
 "
      ],
      "text/plain": [
       "   Unnamed: 0    code character               description  Unnamed: 4\n",
       "0           0  126980         ๐   mahjong tile red dragon         NaN\n",
       "1           1  129525         ๐งต              spool thread         NaN\n",
       "2           2  129526         ๐งถ                 ball yarn         NaN\n",
       "3           3  127183         ๐  playing card black joker         NaN\n",
       "4           4  129296         ๐ค         zipper-mouth face         NaN"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prepStep1Table = table\n",
    "\n",
    "# lowercasing and stopword removal\n",
    "for entry in range(len(table[\"description\"][1:])):\n",
    "    table[\"description\"][entry] = table[\"description\"][entry].lower()\n",
    "    newEntry = []\n",
    "    for word in table[\"description\"][entry].split(\" \"):\n",
    "        if word not in set(stopwords.words('english')):\n",
    "            newEntry.append(word)\n",
    "    table[\"description\"][entry] = (\" \").join(newEntry).lower()\n",
    "        \n",
    "table.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}