ANLP_WS24_CA1/data_explo_stuff.ipynb

632 lines
360 KiB
Plaintext
Raw Permalink Normal View History

2024-11-20 11:52:27 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import nltk\n",
"from nltk.corpus import stopwords\n",
"from nltk.tokenize import word_tokenize\n",
"from collections import Counter"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[nltk_data] Downloading package punkt to\n",
"[nltk_data] C:\\Users\\felix\\AppData\\Roaming\\nltk_data...\n",
"[nltk_data] Package punkt is already up-to-date!\n",
"[nltk_data] Downloading package stopwords to\n",
"[nltk_data] C:\\Users\\felix\\AppData\\Roaming\\nltk_data...\n",
"[nltk_data] Package stopwords is already up-to-date!\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# nltk count words\n",
"nltk.download('punkt')\n",
"nltk.download('stopwords')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# dataset stupistuff"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"# Load the data from the JSON file\n",
"data_path = './data/stupidstuff.json'\n",
"with open(data_path) as f:\n",
" data = json.load(f)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"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>body</th>\n",
" <th>category</th>\n",
" <th>id</th>\n",
" <th>rating</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>A blackjack dealer and a player with a thirtee...</td>\n",
" <td>Children</td>\n",
" <td>1</td>\n",
" <td>2.63</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>At a dinner party, several of the guests were ...</td>\n",
" <td>Blonde Jokes</td>\n",
" <td>2</td>\n",
" <td>2.57</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>One day this cop pulls over a blonde for speed...</td>\n",
" <td>Blonde Jokes</td>\n",
" <td>3</td>\n",
" <td>3.09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Three women are about to be executed for crime...</td>\n",
" <td>Blonde Jokes</td>\n",
" <td>4</td>\n",
" <td>4.10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>A girl came skipping home FROM school one day....</td>\n",
" <td>Blonde Jokes</td>\n",
" <td>5</td>\n",
" <td>4.30</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" body category id rating\n",
"0 A blackjack dealer and a player with a thirtee... Children 1 2.63\n",
"1 At a dinner party, several of the guests were ... Blonde Jokes 2 2.57\n",
"2 One day this cop pulls over a blonde for speed... Blonde Jokes 3 3.09\n",
"3 Three women are about to be executed for crime... Blonde Jokes 4 4.10\n",
"4 A girl came skipping home FROM school one day.... Blonde Jokes 5 4.30"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# create pandas dataframe of the data\n",
"df = pd.DataFrame(data)\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(744, 4)\n",
"People clap when they see you -- their hands over their eyes or ears.\n",
"Insults\n",
"1592\n",
"-----------\n",
"It was the end of the school year. The teacher had turned in her grades; there was nothing really for the class to do.All the kids were restless and it was near the end of the day. So the teacher thought of an activity. She said, \"The first ones to answer correctly the questions I ask may leave early today.\" Little Johnny said to himself, \"Good, I'm smart and I want to get outa here.\"The teacher asked, \"Who said 'Four Score and Seven Years Ago'?\" But before Johnny could open his mouth, Susie said, \"Abraham Lincoln?\"The teacher said, \"That's right, Susie. You may go.\" Johnny was mad that Susie had answered first.The teacher asked, \"Who said 'I Have a Dream'?\" But before Johnny could open his mouth, Mary said, \"Martin Luther King!\" The teacher said, \"That's right, Mary. You may go.\" Johnny was even madder than before. Mary had answered first. The teacher asked, \"Who said 'Ask not what your country can do for you'?\" Before Johnny could open his mouth, Nancy piped, \"John Kennedy!\"The teacher said, \"That's right, Nancy. You may go.\" Now Johnny was furious! Nancy had answered first.Then the teacher turned her back, and Johnny muttered, \"I wish these girls would keep their mouths shut!\"The teacher spun around. \"WHO SAID THAT?\" Johnny said, \"BILL CLINTON. CAN I GO NOW?\"\n",
"Miscellaneous\n",
"2100\n",
"-----------\n",
"The Secret Service was looking for more employees. They put up a sign and the next day they picked the next three people. They brought the first guy into a room and gave him a pistol and said\" Your wife is in that room go in and shoot her\" The guy looked at them and said\" No I can't do it\" So the Secret Service brought out the next guy and told him the same thing and handed him the gun. \"He went into the room and came back out but he didn't want to shoot her. So the Secret Service who was really desperate brought the last person in. She was a blonde so they were worried. They said\" Your husbandis in that room and I want you to shoot him.\" \"Alright\" she announced. She went into the room and the Secret Service heard alot of crashing and banging. They went in and found the man dead. \"What the hell is going on\" \"Oh The gun was a blank so I beat him to death with a chair.\"\n",
"Blonde Jokes\n",
"114\n",
"-----------\n",
"Q: How many software people does it take to screw in a light bulb?\n",
"A: None. That's a hardware problem.\n",
"A: One, but if he changes it, the whole building will probably fall down.\n",
"A: Two. One always leaves in the middle of the project.\n",
"Light Bulbs\n",
"2769\n",
"-----------\n",
"\n",
"Bar Jokes\n",
"3558\n",
"-----------\n"
]
}
],
"source": [
"# get jokes with highest scores min 4.5\n",
"good_jokes = df[df['rating'] >= 4.5].values\n",
"# random sample of 5 jokes\n",
"print(np.array(good_jokes).shape)\n",
"# 5 random indices min max\n",
"number_of_jokes = 5\n",
"idx = np.random.randint(0, len(good_jokes), number_of_jokes)\n",
"for i in idx:\n",
" print(good_jokes[i][0])\n",
" print(good_jokes[i][1])\n",
" print(good_jokes[i][2])\n",
" print('-----------')"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Animals\n",
"Aviation\n",
"Bar Jokes\n",
"Blind Jokes\n",
"Blonde Jokes\n",
"Business\n",
"Children\n",
"Computers\n",
"Crazy Jokes\n",
"Deep Thoughts\n",
"English\n",
"Ethnic Jokes\n",
"Family, Parents\n",
"Farmers\n",
"Food Jokes\n",
"Heaven and Hell\n",
"Holidays\n",
"Idiots\n",
"Insults\n",
"Lawyers\n",
"Light Bulbs\n",
"Love & Romance\n",
"Marriage\n",
"Medical\n",
"Men\n",
"Military\n",
"Miscellaneous\n",
"Money\n",
"Music\n",
"Office Jokes\n",
"Old Age\n",
"One Liners\n",
"Police Jokes\n",
"Political\n",
"Redneck\n",
"Religious\n",
"School\n",
"Science\n",
"Sex\n",
"Sports\n",
"State Jokes\n",
"Women\n",
"Yo Mama\n",
"amount of categories: 43\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAItCAYAAAA9haCkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADXwElEQVR4nOzdd1gU1/s28HvpHSwUURSwo9iNEmsQRezRaFTsWKJo7FG/sWvsvaLG3mNN7C12UbEbe9eooLGAooLA8/7Bu/Nj2QV2FaJu7s917XWxM2fPnll2Zp85VSUiAiIiIiIjZvKpC0BERESU1RjwEBERkdFjwENERERGjwEPERERGT0GPERERGT0GPAQERGR0WPAQ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vgD9erVQ7t27VC2bFnExsbi4sWLWL9+Pe7evYucOXOiY8eOeP78Ofz9/ZEnTx7cu3cPM2fORKlSpVC0aNEMy1ygQAFUrlwZXbt2RVxcHKZNm4YcOXJoNKXNnj0blStXhq+vLzp16gRvb29ERUUhPDwcf//9N86fP/9Bn1ebNm2wbNky9OnTBydPnkSVKlUQGxuLvXv3olu3bmjYsCHq1q2LKVOmoHbt2mjZsiWePHmC2bNno0CBArhw4YJGfmXLlsXevXsxZcoUuLu7w8vLCxUqVMC4ceOwf/9+VKhQAZ06dYKPjw+eP3+OM2fOYO/evXj+/DkAoEuXLpg1axZatGiBnj17IleuXFi5cqXSMVld62Nubo7x48ejffv2qFatGlq0aKEMS/f09ETv3r3
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#print unique categories\n",
"categories = df['category'].unique()\n",
"categories= sorted(categories)\n",
"for category in categories:\n",
" print(category)\n",
"print('amount of categories:', len(categories))\n",
"# plot the distribution of categories\n",
"category_counts = df['category'].value_counts()\n",
"category_counts.plot(kind='bar')\n",
"plt.title('Jokes per category')\n",
"plt.ylabel('Number of jokes')\n",
"plt.xlabel('Category')\n",
"plt.xticks(rotation=90)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHHCAYAAABZbpmkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA/CklEQVR4nO3df3xP9f//8ftrm22MbU22WZiFsPx6m/AKJZZhiVCRGIn323tTTKX19kYUUvk99O6rzY+8Re9Qfs+PeJcRSkklClP7pWRDb9ts5/uHy16fXkbx2mt7zel2vVzO5dJ5nuc55/E8xu6d8zyvl8UwDEMAAAAm5eb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Vr15dlStXVkRERIm5XBaLRRcuXNDixYtt16f4Z+Jqc3aKH/N99NFHat26tby9vXX77bdryZIlJer64osvdO+996py5cqqVauWXnrpJSUlJZU45v79+xUVFaVbb71VlStXVlhYmJ544gmHrwfwW9zZAZxg4MCBeuGFF7RlyxYNGzbsqn0OHz6sBx54QM2aNdOkSZPk5eWlY8eO6eOPP5YkNW7cWJMmTdL48eM1fPhw2y+vu+++23aMn3/+Wd26dVO/fv30+OOPKygo6Hfrevnll2WxWDR27FhlZ2dr1qxZioyM1MGDB213oK7H9dT2W4Zh6MEHH9SOHTs0dOhQtWjRQps3b9azzz6rH3/8UTNnzrTr/9FHH+m9997T3//+d1WrVk1z5sxRnz59lJaWpurVq1+zrv/973/q2LGjjh07pri4OIWFhWnVqlUaPHiwzp49q6efflqNGzfW0qVLNXr0aNWqVUtjxoyRJNWoUeO6x3+j4/mtcePGacqUKXrjjTdsPxtLly5VTEyMoqKi9Morr+jXX3/VggUL1L59e3322WcOTfYuDg633HKLXfvs2bP14IMPasCAAcrPz9eKFSv08MMPa926dYqOjrbV8+STT6p169YaPny4JKlevXq/e75jx46pb9++Gjp0qGJiYvTWW29p8ODBioiI0J133ilJ+vHHH3XffffJYrEoISFBPj4++n//7/+VeCSWnZ2tLl26qEaNGnr++efl7++vEydO6L333rvh6wBclQHgDyUlJRmSjH379l2zj5+fn/GXv/zFtj5hwgTjt3/FZs6caUgyTp8+fc1j7Nu3z5BkJCUlldh27733GpKMhQsXXnXbvffea1vfsWOHIcm47bbbjNzcXFv7ypUrDUnG7NmzbW2hoaFGTEzMHx7z92qLiYkxQkNDbetr1qwxJBkvvfSSXb++ffsaFovFOHbsmK1NkuHp6WnX9vnnnxuSjLlz55Y412/NmjXLkGQsW7bM1pafn29YrVajatWqdmMPDQ01oqOjf/d41+p7o+OJjY01DMMwxowZY7i5uRnJycm27efOnTP8/f2NYcOG2R0rMzPT8PPzK9F+peI/27feess4ffq0kZ6ebmzatMmoX7++YbFYjE8++cSu/6+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d17txZM2bM0FdffaWXX35Z27dvtz26cPYnLhffRShmGIaOHTtmNwH2lltu0dmzZ0vse+XdihupLTQ0VOnp6SUe633zzTe27c4QGhqqo0ePlrg7VhbnuZHx1K9fX1u2bFF6erq6du1qt1/x47rAwEBFRkaWWK72Vt31mDZtmi5evKiXX37Z1vaf//xH3t7etvDQrVs3W0C6Ull82ndoaKiOHTtWov1qbZLUtm1bvfzyy9q/f7/efvttHT58WCtWrHB6XfjzIewApbR9+3ZNnjxZYWFhJeYi/NaZM2dKtBXPZSi+Xe/j4yNJVw0fjliyZIndL9p3331XGRkZ6tatm62tXr162rNnj/Lz821t69atK/GK+o3U1r17dxU
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# plot the distribution of ratings\n",
"ratings = df['rating']\n",
"plt.hist(ratings, bins=100)\n",
"plt.xlabel('Rating')\n",
"plt.ylabel('Frequency')\n",
"plt.title('Distribution of Joke Ratings')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAItCAYAAADFZVtTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADUSElEQVR4nOzdd1QU19sH8O/Se1ERFFFEFHvvGns3ItFo7GI3scWuiV1jizVq7A177L0QI3aNvcZeUKNYoqKoqPC8f/Du/Bh2gVlEMZvv55w9hx3uzN6dbc/c+9x7dSIiICIiIjITFmldASIiIqLUxOCGiIiIzAqDGyIiIjIrDG6IiIjIrDC4ISIiIrPC4IaIiIjMCoMbIiIiMisMboiIiMisMLghIiIis8Lghog+SzqdDsOGDfvkjxsWFgadToc1a9Z88scmotTB4IYonl9//RU6nQ6lSpVK66p8dnx9faHT6ZSbo6MjSpYsiZ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r1mH9+vWYNWsW7O3tUaFCBWTKlAmrVq1C+fLl8ccff+DHH39U7ZMjRw6cOXMGVatWTfGV59q1a2FnZ4edO3fC1tZW2b5w4UJVuWzZsiE2NhY3b95UtTRcu3ZNVc7DwwPOzs6IiYlRgpPUULduXVSsWBGjR49Gp06d4OjoiHPnzuHKlStYvHgxWrVqpZQNDQ012P9jXJlrPSfJuXr1quq+iODatWsGQUCrVq1Qv359HDt2DMuWLUORIkWQL1++JI/t4OCAKlWq4I8//sCdO3cMAt6EtL4
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# plot the average rating per category\n",
"means = [df[df['category'] == category]['rating'].mean() for category in categories]\n",
"\n",
"plt.bar(categories, means)\n",
"plt.xlabel('Category')\n",
"plt.ylabel('Average Rating')\n",
"plt.title('Average Rating by Category')\n",
"plt.xticks(rotation=90)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAApYAAAHHCAYAAAAFyBjFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd1QU19/H8fcC0psgCiqCgqIoWKLGjh0bsWCNDcXeO5aooLHG3jvYe4mxY8FYSKwQFcUSFDVYgoKCgpT7/MGz83MFFAz2+zpnT7Kzd+7cGVb8OjP3MyohhECSJEmSJEmS/iOtTz0ASZIkSZIk6esgC0tJkiRJkiQpR8jCUpIkSZIkScoRsrCUJEmSJEmScoQsLCVJkiRJkqQcIQtLSZIkSZIkKUfIwlKSJEmSJEnKEbKwlCRJkiRJknKELCwlSZIkSZKkHCELS0mSvgoqlQpfX99PPQwJsLe3p0mTJp96GFn2yy+/UKRIEbS1tSlTpswH2UbNmjUpVarUB+k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ZN9s+evRI6Orqivr164uUlBRl+YIFCwQgVq1apSx7vbDcvn27yJUrl+jevbvGenXq1BEuLi4axzI1NVVUqVJFFC1aVFn2vt+lzArLN4vDxMREYW1tLTw9Pd/a3+DBgwWg/OP2XTL6cx4cHJxu+1u3bk03TiGEeP78uTA3Nxfdu3fXWP7gwQNhZmamsdzFxUUULFhQPH/+XFkWFBQkAI3v+65duwQgfv75Z40+W7ZsKVQqlbh586ayLLPfv+Hh4QIQixc
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"category_means = df.groupby('category')['rating'].mean()\n",
"category_means = category_means[categories]\n",
"# give each category a id number and add to plot to each scatter\n",
"category_counts = df['category'].unique()\n",
"\n",
"plt.scatter(category_means, category_counts)\n",
"plt.xlabel('Average Rating')\n",
"plt.ylabel('Number of Jokes')\n",
"plt.title('Average Rating vs. Number of Jokes in Category')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHHCAYAAABeLEexAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABIkklEQVR4nO3dd3gU1f7H8c+mh0ASWhIikERAehMUAqFHIiCC4lW8iIAIFrgUAQULIIgUlXpF1J8CXlEULyqXK02qYKSEJggISBWSoJCEIpByfn/wZC5LQgubQub9ep59HvbM2Znv2c0mH2bOzDiMMUYAAAA25pbfBQAAAOQ3AhEAALA9AhEAALA9AhEAALA9AhEAALA9AhEAALA9AhEAALA9AhEAALA9AhEAALA9AhFsY+TIkXI4HHmyrebNm6t58+bW81WrVsnhcOirr77Kk+13795d4eHhebKtnDpz5oyefvpphYSEyOFwaMCAAfld0k278nNGVgXpPcr8HfDHH3/kdykogAhEuC3Nmj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Npr1aql++67L9vv1o4dO9SsWTOFh4fr+++/V/Hixa1l8+bNU5MmTVS8eHH98ccf1iM6Olrp6elas2aNpEvvydmzZ7Vs2bKbqhcFF4EIhdaZM2eu+UfoscceU+PGjfX0008rODhYnTt31pdffnlT4eiOO+64qQmjlSpVcnrucDhUsWLFXD/N+dChQwoNDc3yfmQeFjl
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"stop_words = set(stopwords.words('english'))\n",
"\n",
"# get all the jokes\n",
"jokes = df['body'].values\n",
"\n",
"# tokenize the jokes\n",
"tokenized_jokes = [word_tokenize(joke) for joke in jokes]\n",
"\n",
"# remove stop words\n",
"filtered_jokes = [[word for word in joke if word.lower() not in stop_words] for joke in tokenized_jokes]\n",
"\n",
"# count the number of words in each joke\n",
"word_counts = [len(joke) for joke in filtered_jokes]\n",
"\n",
"# plot the distribution of word counts\n",
"plt.hist(word_counts, bins=100)\n",
"plt.xlabel('Number of Words')\n",
"plt.ylabel('Frequency')\n",
"plt.title('Distribution of Word Counts in Jokes')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
", 25353\n",
". 22851\n",
"`` 12833\n",
"'' 10173\n",
"? 4538\n",
"! 3501\n",
"'s 3136\n",
": 2863\n",
"said 2359\n",
"n't 2324\n",
"man 1992\n",
"says 1836\n",
"one 1549\n",
"back 1004\n",
"get 970\n",
"asked 962\n",
"would 917\n",
"... 844\n",
"day 840\n",
"-- 824\n",
"'m 819\n",
"time 735\n",
"know 730\n",
"wife 722\n",
"like 719\n",
"' 707\n",
"first 695\n",
"guy 692\n",
"Well 676\n",
"went 668\n",
"got 666\n",
"go 664\n",
"'ll 648\n",
"'re 648\n",
"woman 632\n",
"replied 604\n",
"two 594\n",
"old 590\n",
"asks 581\n",
"- 574\n",
"take 550\n",
"'ve 536\n",
"could 533\n",
"going 487\n",
"little 483\n",
"blonde 481\n",
"next 479\n",
"want 468\n",
"good 467\n",
"see 463\n",
"came 448\n",
"husband 448\n",
"home 441\n",
") 437\n",
"goes 435\n",
"$ 405\n",
"car 404\n",
"replies 403\n",
"doctor 400\n",
"think 398\n",
"say 393\n",
"boy 393\n",
"told 388\n",
"give 385\n",
"three 378\n",
"tell 378\n",
"One 376\n",
"new 375\n",
"way 373\n",
"( 371\n",
"God 369\n",
"around 367\n",
"make 366\n",
"Q 364\n",
"right 362\n",
"* 360\n",
".. 358\n",
"people 358\n",
"door 348\n",
"Oh 342\n",
"years 332\n",
"second 323\n",
"later 320\n",
"ca 316\n",
"never 311\n",
"last 308\n",
"really 308\n",
"room 307\n",
"away 306\n",
"another 301\n",
"young 300\n",
"minutes 299\n",
"look 293\n",
"house 292\n",
"; 292\n",
"dog 292\n",
"night 291\n",
"comes 290\n",
"come 287\n",
"work 284\n"
]
}
],
"source": [
"# count the frequency of each word\n",
"word_freq = Counter()\n",
"for joke in filtered_jokes:\n",
" word_freq.update(joke)\n",
"\n",
"# get the most common words\n",
"most_common = word_freq.most_common(100)\n",
"\n",
"for word, count in most_common:\n",
" print(word, count)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHHCAYAAABZbpmkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABQiUlEQVR4nO3dd1gU1/4G8HdpC9IRaZGmGLvYIqKooCiisecavcYeu1FsUZJYYkywREW9GhMTUW80RpNovEaxgb2EorF3EBUBFQFBRcr5/eHD/FwBhWVhl/H9PM88j3tmduY7Zxd4PXNmVyGEECAiIiKSKT1tF0BERERUnhh2iIiISNYYdoiIiEjWGHaIiIhI1hh2iIiISNYYdoiIiEjWGHaIiIhI1hh2iIi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p/fmcY+goCD4+fmhS5cu2LJlS4n2/TI/Pz9kZmbCyMgIAQEBWLx48WvPQeMElVlYWJgAIKKioordxtLSUjRp0kR6PHv2bPFy9y9dulQAEPfv3y92H1FRUQKACAsLK7SuXbt2AoBYvXp1kevatWsnPY6MjBQAxDvvvCMyMjKk9i1btggAYtmyZVKbq6urGDx48Bv3+braBg8eLFxdXaXH27dvFwDEvHnzVLb74IMPhEKhENevX5faAAgjIyOVtn/++UcAECtWrCh0rJeFhoYKAOLnn3+W2p4/fy68vb2FmZmZyrm7urqKrl27vnZ/Bf71r38JExMT8fz5cyGEECEhIcLd3V0IIcSqVauEnZ2dtO3
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"# get all the jokes with ratings greater than 4.5\n",
"good_jokes = df[df['rating'] >= 4.5]['body'].values\n",
"\n",
"# tokenize the jokes\n",
"tokenized_good_jokes = [word_tokenize(joke) for joke in good_jokes]\n",
"\n",
"# remove stop words\n",
"filtered_good_jokes = [[word for word in joke if word.lower() not in stop_words] for joke in tokenized_good_jokes]\n",
"\n",
"# count the number of words in each joke\n",
"word_good_counts = [len(joke) for joke in filtered_good_jokes]\n",
"\n",
"# plot the distribution of word counts\n",
"plt.hist(word_good_counts, bins=100)\n",
"plt.xlabel('Number of Words')\n",
"plt.ylabel('Frequency')\n",
"plt.title('Distribution of Word Counts in Jokes with ratings >= 4.5')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAHHCAYAAACRAnNyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABvIUlEQVR4nO3dd3hUVf4/8PedSTKTOmmEhJaEbuhFIHQQpC2w69oQEF1X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xGjhxp2Pbqq68iIyMDrVu3Rr9+/bBo0SKLwaozHnnkEezYsQNbt27FnDlzUFFRAa1Wa3bcwYMHMWrUKMM4n2bNmuG5554DALcClVatWpmNUYqKijL62b548SLatWtndlz79u1dvi4RwOnJ1AS0bdsW06ZNwzvvvIP58+eb7bc2SNTSg0BPqVQ6tA2oG+TpLH1vyYoVK9CzZ0+Lx4SFhRl9Xf+vaV/QBx4HDhxASEgIACA1NRUAEBsbiw4dOuDAgQOGQcP2Bvza4k5bhw4diqysLHz++ef45ptv8O6772LlypVYs2aNUU+ZJffccw+WLFmCvLw8hIeHY8uWLZgyZQoCAn77VXr33XdjyJAh2Lx5M7755husWLECy5cvx6effopx48a5VOcOHTpg1KhRAIDf/e53UCqVmD9/PkaMGIG+ffsCqBtYe9ttt6Fz5874+9//jtatWyMoKAjbtm3DypUrzXrgnOHJn20iZ7FHhZoEfa/K8uXLzfbp/+IuLCw02u5qz4I
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# joke length vs rating\n",
"plt.scatter(word_counts, ratings)\n",
"plt.xlabel('Number of Words')\n",
"plt.ylabel('Rating')\n",
"plt.title('Number of Words vs. Rating')\n",
"plt.show()"
]
}
],
"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.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}