nlp-lab/Project/Tools/Preprocessing.ipynb
2018-05-31 13:15:21 +02:00

152 lines
3.7 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from nltk.corpus import stopwords"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"table = pd.read_csv(\"emoji_descriptions.csv\", names=(\"id\",\"char\", \"description\"))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>char</th>\n",
" <th>description</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>NaN</th>\n",
" <td>code</td>\n",
" <td>character</td>\n",
" <td>descripion,</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0.0</th>\n",
" <td>126980</td>\n",
" <td>🀄</td>\n",
" <td>MAHJONG TILE RED DRAGON</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1.0</th>\n",
" <td>129525</td>\n",
" <td>🧵</td>\n",
" <td>SPOOL OF THREAD</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2.0</th>\n",
" <td>129526</td>\n",
" <td>🧶</td>\n",
" <td>BALL OF YARN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3.0</th>\n",
" <td>127183</td>\n",
" <td>🃏</td>\n",
" <td>PLAYING CARD BLACK JOKER</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id char description\n",
"NaN code character descripion,\n",
" 0.0 126980 🀄 MAHJONG TILE RED DRAGON\n",
" 1.0 129525 🧵 SPOOL OF THREAD\n",
" 2.0 129526 🧶 BALL OF YARN\n",
" 3.0 127183 🃏 PLAYING CARD BLACK JOKER"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"table.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"prepStep1Table = table\n",
"print(table[3])\n",
"# lowercasing\n",
"#for entry in table[\"description\"][1:]:\n",
" # prepStep1Table[\"description\"][entry] = table[\"description\"][entry].toLower()\n",
"#print(prepStep1Table)\n",
"#stopword removal\n",
"#for entry in prepStep1Table[\"description\"][1:]:"
]
},
{
"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
}