1743 lines
572 KiB
Plaintext
1743 lines
572 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# This notebook does preprocessing, and pre-analysing data before the annotation\n",
|
||
|
"The actions done in this notebook are \n",
|
||
|
"- data merging\n",
|
||
|
"- data analysis and visualisation\n",
|
||
|
"- language identification\n",
|
||
|
"- sentiment analysis\n",
|
||
|
"- GDPR protection\n",
|
||
|
"- samples containing swear words detection"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/Users/A200119424/anaconda3/envs/sentiment/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
||
|
" from .autonotebook import tqdm as notebook_tqdm\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import json\n",
|
||
|
"import numpy as np\n",
|
||
|
"from transformers import pipeline\n",
|
||
|
"from tqdm import tqdm\n",
|
||
|
"import random\n",
|
||
|
"import re\n",
|
||
|
"import pickle\n",
|
||
|
"\n",
|
||
|
"import matplotlib.pyplot as plt"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# macros\n",
|
||
|
"\n",
|
||
|
"OPTIMUM_WIDTH = 0.6\n",
|
||
|
"ALIGN = 'center'\n",
|
||
|
"\n",
|
||
|
"# colors\n",
|
||
|
"BLUE = '#4040a1'\n",
|
||
|
"GREEN = '#618685'\n",
|
||
|
"YELLOW = '#feb236'\n",
|
||
|
"ORANGE = '#f18973'\n",
|
||
|
"AQUA = '#d5f4e6'\n",
|
||
|
"BLACK = '#000000'"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def load_jsonl(file_path):\n",
|
||
|
" with open(file_path, 'r', encoding='utf-8') as file:\n",
|
||
|
" return [json.loads(line) for line in file]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def load_json(filename):\n",
|
||
|
" with open(filename) as json_file:\n",
|
||
|
" return json.load(json_file)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Merge ficos data"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"merged_fico = []\n",
|
||
|
"for ficos_chunk in range(0,4):\n",
|
||
|
" merged_fico += load_jsonl(f'clustered_jsonl/fico_chunk_{ficos_chunk}.jsonl')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def create_jsonl(filename, new_dataset):\n",
|
||
|
" with open(f'{filename}l', 'w') as jsonl_file:\n",
|
||
|
" for item in new_dataset:\n",
|
||
|
" jsonl_file.write(json.dumps(item) + '\\n')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"create_jsonl('clustered_jsonl/robert_fico_data.json', merged_fico)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Merge toppic data"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def get_post_ids(posts):\n",
|
||
|
" return [post['id'] for post in posts]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def open_data(fname: str):\n",
|
||
|
" jsonl_data = load_jsonl(f'clustered_jsonl/{fname}l')\n",
|
||
|
" json_data = load_json(f'json_data_id/{fname}')\n",
|
||
|
"\n",
|
||
|
" post_ids = get_post_ids(json_data)\n",
|
||
|
" n_posts = len([post for post in jsonl_data if post['id'] in post_ids])\n",
|
||
|
"\n",
|
||
|
" dataset_info = {\n",
|
||
|
" 'name': \" \".join(fname.split('_')[: -1]),\n",
|
||
|
" 'samples': len(jsonl_data),\n",
|
||
|
" 'n_posts': n_posts,\n",
|
||
|
" 'post_ids': post_ids\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
" return jsonl_data, dataset_info"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Politicians"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"fico_samples, fico_info = open_data(\"robert_fico_data.json\")\n",
|
||
|
"matovic_samples, matovic_info = open_data(\"igor_matovic_data.json\")\n",
|
||
|
"ekalinak_samples, ekalinak_info = open_data(\"erik_kaliňák_data.json\")\n",
|
||
|
"caputova_samples, caputova_info = open_data(\"zuzana_čaputová_data.json\")\n",
|
||
|
"kotleba_samples, kotleba_info = open_data(\"marian_kotleba_data.json\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Memes"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"zomri_samples, zomri_info = open_data(\"zomri_data.json\")\n",
|
||
|
"emefka_samples, emefka_info = open_data(\"emefka_data.json\")\n",
|
||
|
"ok_prv_samples, ok_prv_info = open_data(\"ok,ale_ideš_prvý_:d_data.json\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Media"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"eva_samples, eva_info = open_data(\"eva_-_hriešne_dobrá_data.json\")\n",
|
||
|
"aktuality_samples, aktuality_info = open_data(\"aktuality_data.json\")\n",
|
||
|
"dennikN_samples, dennikN_info = open_data(\"denník_n_data.json\")\n",
|
||
|
"tvJOJ_samples, tvJOJ_info = open_data(\"televízia_joj_data.json\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Famous people"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"peter_marcin_samples, peter_marcin_info = open_data(\"peter_marcin_data.json\")\n",
|
||
|
"sajfa_samples, sajfa_info = open_data(\"sajfa_data.json\")\n",
|
||
|
"jan_kolenik_samples, jan_kolenik_info = open_data(\"ján_koleník_data.json\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Sports"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sport24_samples, sport24_info = open_data(\"šport24_data.json\")\n",
|
||
|
"dominika_cibulkova_samples, dominika_cibulkova_info= open_data(\"dominika_cibulkova_data.json\")\n",
|
||
|
"hetrik_samples, hetrik_info = open_data(\"hetrik_data.json\")\n",
|
||
|
"RTVSsport_samples, RTVSsport_info = open_data(\"šport_v_rtvs_data.json\")\n",
|
||
|
"sagan_samples, sagan_info = open_data(\"peter_sagan_data.json\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Data analysis & visualisation"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def show_scraped_data(toppic: str, samples: list, names: list, posts: list):\n",
|
||
|
" fig, ax = plt.subplots(\n",
|
||
|
" nrows = 1,\n",
|
||
|
" ncols = 2,\n",
|
||
|
" figsize = (17, 5)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" fig.suptitle(f'Number of extracted records on toppic: {toppic}', fontsize=20)\n",
|
||
|
"\n",
|
||
|
" # first barh chart\n",
|
||
|
" \n",
|
||
|
" for axis in ax:\n",
|
||
|
" axis.set_ylabel('Facebook profiles')\n",
|
||
|
" axis.set_xlabel('Number of samples')\n",
|
||
|
" \n",
|
||
|
" ax[0].title.set_text(\"All samples\")\n",
|
||
|
" ax[0].set_xlim(0, max(samples) * 1.2)\n",
|
||
|
"\n",
|
||
|
" for idx, val in enumerate(samples):\n",
|
||
|
" ax[0].text(val, idx, str(val), color='black', va='center')\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" ax[0].barh(\n",
|
||
|
" y = names,\n",
|
||
|
" width = samples,\n",
|
||
|
" edgecolor = BLACK,\n",
|
||
|
" color = [BLUE, GREEN, AQUA, ORANGE, YELLOW]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" # second barh chart\n",
|
||
|
" \n",
|
||
|
" ax[1].title.set_text(\"Posts\")\n",
|
||
|
" ax[1].set_xlim(0, max(posts) * 1.2)\n",
|
||
|
"\n",
|
||
|
" ax[1].barh(\n",
|
||
|
" y = names,\n",
|
||
|
" width = posts,\n",
|
||
|
" edgecolor = BLACK,\n",
|
||
|
" color = [BLUE, GREEN, AQUA, ORANGE, YELLOW]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" for idx, val in enumerate(posts):\n",
|
||
|
" ax[1].text(val, idx, str(val), color='black', va='center')\n",
|
||
|
"\n",
|
||
|
" plt.subplots_adjust(wspace=0.5)\n",
|
||
|
" plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 16,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def execute_visualisation(toppic: str, info_list: list):\n",
|
||
|
"\n",
|
||
|
" if toppic == None:\n",
|
||
|
" each_sample = np.empty(0, dtype=np.int32)\n",
|
||
|
" each_post = np.empty(0, dtype=np.int32)\n",
|
||
|
" names = np.array([\n",
|
||
|
" 'Politicians',\n",
|
||
|
" 'Memes',\n",
|
||
|
" 'Media',\n",
|
||
|
" 'Famous people',\n",
|
||
|
" 'Sports'\n",
|
||
|
" ]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" for toppic in info_list:\n",
|
||
|
" each_sample = np.append(each_sample, sum([profile['samples'] for profile in toppic]))\n",
|
||
|
" each_post = np.append(each_post, sum([profile['n_posts'] for profile in toppic]))\n",
|
||
|
"\n",
|
||
|
" show_scraped_data('By toppic', each_sample, names, each_post)\n",
|
||
|
" else:\n",
|
||
|
" each_sample = np.array(\n",
|
||
|
" [item['samples'] for item in info_list]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" names = np.array(\n",
|
||
|
" [item['name'] for item in info_list]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" each_post = np.array(\n",
|
||
|
" [item['n_posts'] for item in info_list]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" show_scraped_data(toppic, each_sample, names, each_post)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Scraped data visualisation\n",
|
||
|
"Those graphs represent how many samples we were able to extract from Facebook, those data are cleaned and clustered based on their semantical similarity."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABc0AAAHyCAYAAAA5sObnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACp5UlEQVR4nOzdd3QU5dvG8WtDCglJCCmUQIDQAwKhWOhBQDoCUkSULtKko8JPKRaKUlVElN5EqnSRjiAllCBK79KVDqEm8/5BMm+W1IUNCeH7OWfPSWaemblndmd37nuffcZiGIYhAAAAAAAAAAAgh5QOAAAAAAAAAACA1IKiOQAAAAAAAAAAUSiaAwAAAAAAAAAQhaI5AAAAAAAAAABRKJoDAAAAAAAAABCFojkAAAAAAAAAAFEomgMAAAAAAAAAEIWiOQAAAAAAAAAAU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HGps3bza2bt1qfPPNN8a///5rGMbDArKDg4Px6quvGl999ZXx66+/Gjt37jTWr19vTJo0yShTpoy53RYtWsR7jD799FOznZeXl9GvXz9j1apVxq5du4y1a9caw4cPN8qWLWuEhISYyxw7dszYu3evue+vv/56rP06duyY1XZ+/vln88uFPHnyGCNHjjRjnj9/vlGrVi0zjh49esQZa7du3cw28Z0zL774YoKFtKSIfq/w8fEx/P39DXd3d+N///ufeW5NnDjROHDggGEYhvHff/8ZAQEBZoGwS5cuxty5c43Q0FBj3bp1Rt++fQ03Nzdzv69
|
||
|
"text/plain": [
|
||
|
"<Figure size 1700x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Politics\n",
|
||
|
"politics_info_list = [fico_info, matovic_info, ekalinak_info, caputova_info, kotleba_info]\n",
|
||
|
"execute_visualisation('Politics', politics_info_list)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABdYAAAHyCAYAAADm/pz4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACSvklEQVR4nOzdd3gU1fv38c+GhBSSUBJaJIQSegcBASEUkd4VRBQQEFERKaLCVyEoTVBEUVAR6UgVBQUpQlA6AYIISC9KlV5CTc7zB0/ml5A6kBCSvF/XtRfszJkz98zuTua+d/aMwxhjBAAAAAAAAAAAksQptQMAAAAAAAAAACAtobAOAAAAAAAAAIANFNYBAAAAAAAAALCBwjoAAAAAAAAAADZQWAcAAAAAAAAAwAYK6wAAAAAAAAAA2EBhHQAAAAAAAAAAGyisA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OMihQpoixZssjV1VWPPfaYWrRooTlz5igyMjJJ++fIkSN65513VKlSJfn4+MjFxUW+vr6qWbOmgoODY2x/VJxHjx6VJE2dOjXWdsV3o75Tp07pf//7nx5//HHlyJFDrq6u8vf3V9u2ba0hgBIT9ZnLnj27PD09Vbp0aQ0ePFgXL15M0vKJufdYcfLkSb3zzjsqVaqUvLy85HA4FBISEmOZiIgITZ06VU2bNpWfn59cXV3l4+OjJ598UmPGjNH169cTXW9kZKS+//57tWnTRvnz55e7u7vc3d1VtGhRdejQQfPnz4+3mHfr1i2NHz9ederUUc6cOZU5c2blyZNHjRs31owZMxJ8H9zP9v777796/fXXVahQIbm5ucnPz0/NmzdP8mso3f21UsuWLZUvXz65urrKy8tLhQoVUs2aNfX+++/f99+EKFevXtXIkSNVrVo1672WL18+PfPMM/r5558TXPbez+Lx48fVt29fBQYGyt3dXT4+PmrQoIGWLl163/E5HA4VLFjQev7SSy/F+hzFdfyNjIzUjBkz1LhxY+XJk0eZM2dWzpw5VadOHY0fP163bt2Kd5333vPh4sWLGjx4sEqVKiVPT0/lyJFDderU0ffff59g7Pf+3d2yZYvat28vf39/ubm5yd/fXy+99JL+/vvvePuwM778unXr1K1bNxUrVkze3t7KnDmz8uXLp6ZNm+rLL79Mts9+Ytq1aycXFxedPXs23td+6dKl+u+//+Ti4pKkG7RHuXTpkkaMGKEaNWpYn+G8efOqWbNmmj9/foLnFPe+X1avXq2WLVvKz89P7u7uKlGihD788ENdu3YtxnJLlixR48aNrXYlS5bUiBEjEnwPRblx44a++OIL1atXz3of5sqVS0899ZQmTZqkO3fuJLj8qlWr1L59exUsWFDu7u7y8PBQQECAnnjiCb311ltatWpV4jsNAJD6DAAAeGhWr15tJBlJZvLkyebEiRPG3d3dSDJPP/10nMt06tTJWiYuAQEBRpLp1KlTguuO6icgICDWvMOHD8eI69VXX7We3/to3bq1uXPnjrlx44Z55pln4m338ssvxxtLVJvBgweb4ODgePvImjWr+f333+PtJyIiwvTp08c4HI54+3B2djZff/11nMtPnjzZardlyxZTvnz5WMsPHjw4wf0al+HDhxsnJ6d4Y3J1dTVTp06Nd78k9LDr+vXr5rnnnkuwzyxZsphFixbFWvbPP/80rq6uRpKpVq2auXPnTqw2K1assPZ/mzZtrOnR921Cj8OHD1vLBAUFGUkmKCjI/PjjjyZLlizxtr9z506C+zjqUb9+fXPlypUE99Ho0aONi4tLgv0EBQXFijOp7aPMmDEjzm2K/ujatau5fft2nHHevn3bPPvss/EuW6hQIXPo0KEHeu8aE/NYsWHDBuPr6xtrXatXr7baHz161JQrVy7B7QoMDDR79+6Nd52HDx+O8/OX0HqjL1u8ePEEl3vyySfNuXPnkmV7f//9d+Pt7R3vuoKDg83gwYPj/czeuXMnwdcx6lGpUqUkv2b32rZtm/Hz80uw/9atW5vr16/HuXz0z+LatWvj3CdRj9GjR99XjEk5Ptz7Hj537pypUaNGgsuUKFHCHDlyJM51Rn9dDh06ZAoXLhxvP23bto33sxj97+6kSZOMs7NznH24urqauXPnxtnHvX934xIeHm7at29vez/du63x9Z8UUe+FqHOH5s2bG0nmmWeeibN91Hu7RYsWxpj/21dxHROjrFy50vj4+CS4jY0bN473WB59P4wYMSLec4Lq1aubq1evmsjISNOrV69419WwYcM4/95FCQsLs7YrvkflypXNqVOn4ly+d+/eib6mPj4+8a4fAPDooLAOAMBDdG9h3Rhj+vbta037448/Yi3zsAvrVatWtZLYH374wWzdutX8+OOP1nRJZuLEieaNN94wkszzzz9vfv75Z7N161Yze/bsGAWupUuXxhlL1PzHH3/cSDLFihUzkyZNMlu2bDErV640r7zyilU09fb2NseOHYuzn9dee83qq1atWua7774zISEhZvPmzWbixImmVKlS1vyffvop1vLRi79ly5Y1DofDdOzY0fzyyy9m69atZuHChWbJkiUJ7td7ffnll1afOXPmNB9//LHZsGGDWbt2rQkODrYKqw6Hw/zyyy8xlt25c6fZuXOnadGihZFk/Pz8rGlRDzsiIyNNkyZNrHiaNWtmpk+fbtatW2c2bNhgPvvsM5M/f34jyWTOnNls2bIlVh+ffvqptXxwcHCMeefOnbOKd35+fubs2bPWvAsXLpidO3fG+JLm3m3ZuXOnuXXrlrVMVAGnYMGCxtPT0+TMmdOMHDnSrFu3zmzcuNGMGzfO/Pfff8aYu0VmJycnU7duXTN69Gjz66+/mq1bt5qQkBDz3XffmWrVqlnr7dixY7z76IMPPrDaZcuWzQwcONCsWLHCbNu2zaxatcp8/PHHpnr16qZ27drWMocOHTI7d+60tr1FixaxtuvQoUMx1jNnzhyr2FOoUCEzZswYK+Y
|
||
|
"text/plain": [
|
||
|
"<Figure size 1700x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Memes\n",
|
||
|
"memes_info_list = [zomri_info, emefka_info, ok_prv_info]\n",
|
||
|
"execute_visualisation('Memes', memes_info_list)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABeIAAAHyCAYAAACH5r66AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACb7UlEQVR4nOzdd3gU5ff38c+GFBLSIAklEAi9VxEEhARB6VWqKE1UUKSrgF8kqIgiAgqCokhHRAQFRDD0IjUBpPfee4u0ZJ4/eDK/LMkm2ZAlkLxf17UXZOaee87M7s7OOTt7j8UwDEMAAAAAAAAAAMAhnNI6AAAAAAAAAAAA0jMK8QAAAAAAAAAAOBCFeAAAAAAAAAAAHIhCPAAAAAAAAAAADkQhHgAAAAAAAAAAB6IQDwAAAAAAAACAA1GIBwAAAAAAAADAgSjEAwAAAAAAAADgQBTiAQAAAAAAAABwIArxAADgiWO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GBgcbFixfNeVeuXDF27Nhh9aXOw9uyY8cO4+7du+YysQWf/PnzG56enkZAQIDx+eefG+vWrTM2bNhgjBkzxrhw4YJhGA+K0k5OTsYLL7xgfPnll8bixYuNiIgIY+XKlcZPP/1kVKlSxVxv+/btbe6jjz/+2Gzn6+trDBw40AgPDzciIyON5cuXGyNGjDCqVq1qhIaGmsscPnzY2LFjh7ntTZo0ibddhw8ftlrPL7/8Yn5hUaBAAWPkyJFmzL/
|
||
|
"text/plain": [
|
||
|
"<Figure size 1700x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Media\n",
|
||
|
"media_info_list = [eva_info, aktuality_info, dennikN_info, tvJOJ_info]\n",
|
||
|
"execute_visualisation('Medias', media_info_list)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 20,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABbAAAAHyCAYAAAA6B+jPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACU10lEQVR4nOzdeZxO9f//8ec1hlnMxsxYJmPsu+yEZKSF7EJUiFRECH1CxaiUkqVIpWSXLSQp2bfsY6SUyFiyZl8m28z794ffnO9cZr3GNeYy87jfbtftNnPO+7zP61xnuc7rdZ3rHJsxxggAAAAAAAAAABfjltkBAAAAAAAAAACQFArYAAAAAAAAAACXRAEbAAAAAAAAAOCSKGADAAAAAAAAAFwSBWwAAAAAAAAAgEuigA0AAAAAAAAAcEkUsAEAAAAAAAAALokCNgAAAAAAAADAJVHABgAAAAAAAAC4JArYAIBsz2azyWazKSIiIrNDcVmxsbH6+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2Y8Xx48f1+uuvq3z58vL19ZXNZtOaNWvspomNjdXUqVPVtGlThYSEyMPDQ4GBgXrwwQc1evRo/ffff6nONy4uTt98842efPJJFS5cWF5eXvLy8lKpUqX0zDPPaP78+XbHn4SuX7+uCRMmqEGDBgoODlauXLlUoEABPfHEE5oxY0aK20F6lveff/5Rz549VaxYMXl6eiokJETNmzdP8zqUpIULF6ply5YqVKiQPDw85Ovrq2LFiqlevXp666230v2ZEO/y5csaMWKEateubW1rhQoVUps2bbRkyZIUp719Xzx69Kj69eunEiVKyMvLS4GBgXr88cf1448/pjs+m82mokWLWv936dIl0X6U1PE3Li5OM2bM0BNPPKECBQooV65cCg4OVoMGDTRhwgRdv3492Xnefk/+8+fPa+jQoSpfvrx8fHyUN29eNWjQQN98802Ksd/+ubtt2zZ16NBBoaGh8vT0VGhoqLp06aI///wz2T4cuf/3xo0b1a1bN5UuXVp+fn7KlSuXChUqpKZNm+rTTz912r7vTL/99pveffddPf7449Y27uPjo5IlS6pz587avHlzitPfvq4uXryoiIgIVaxYUT4+PsqXL5+eeOIJ/fLLL3bTnTp1Sm+++abKly+v3LlzKzAwUC1atNDOnTtTjflOtq2UzrESuv28IymrVq1Shw4dVLRoUXl5ecnb21thYWF64IEHNGDAAK1atSrVZUmKs7b/eFevXtX48ePVsGFD6/3Kly+fHnnkEU2aNEk3b95MtY+DBw/q1VdftY633t7eKlmypF566aVUb1lz+3HiTs8lU7No0SK1bdtWhQsXlqenpwICAlS9enUNGzZM586dc8o8AMClGABAtrV69WojyUgykydPNseOHTNeXl5GknnssceSnKZz587WNEkJCwszkkznzp1TnHd8P2FhYYnGRUdH28XVo0cP6//bX61btzY3b940V69eNW3atEm23QsvvJBsLPFthg4daiIiIpLtw9/f36xbty7ZfmJjY82rr75qbDZbsn24u7ubL774IsnpJ0+ebLXbtm2bqVy5cqLphw4dmuL7mpT33nvPuLm5JRuTh4eHmTp1arLvS0ovR/3333+mffv2KfaZO3dus3jx4kTT/vrrr8bDw8NIMr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PGKpKFhISY06dPW+POnTtndu/ebfdlyO3Lsnv3bnP9+nVrmvhCSdGiRY2Pj48JDg42I0aMMBs3bjSbN28248aNM//++68x5lYx183NzTz88MNm5MiR5qeffjI7duwwa9asMV9//bWpXbu2Nd9OnTol+x69/fbbVruAgAAzePBgs3z5chMZGWlWrVplPvroI1OnTh0THh5uTXPgwAG
|
||
|
"text/plain": [
|
||
|
"<Figure size 1700x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Famous people\n",
|
||
|
"fame_info_list = [peter_marcin_info, sajfa_info, jan_kolenik_info]\n",
|
||
|
"execute_visualisation('Famous people', fame_info_list)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABd0AAAHyCAYAAAAeHmcPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACtN0lEQVR4nOzdd3QU5fv38c+mN5JAAoQSCCX0XqWHIr13iIIoIigiVQUFgooFEcHGVwWpAVQEpAkCEqSXxAACIiUUAQHpvSTz/MGT+WVJhw0Jy/t1zp6TzNxzzzUzW+a6dvYei2EYhgAAAAAAAAAAwENzyOwAAAAAAAAAAACwFxTdAQAAAAAAAACwEYruAAAAAAAAAADYCEV3AAAAAAAAAABshKI7AAAAAAAAAAA2QtEdAAAAAAAAAAAboegOAAAAAAAAAICNUHQHAAAAAAAAAMBGKLoDAAAAAAAAAGAjFN0BAECWZ7FYZLFYFBYWltmhZFmxsbGaNGmSqlWrJm9vb3OftW3bNrNDQxbH6yvzhYWFmccBSMqRI0fM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586dUpfffWVOnbsqODgYHl6esrV1VX58uVTmzZt9P333ysuLi5N++fIkSN64403VLlyZfn5+cnZ2Vn+/v6qU6eOwsLCrLY/Ps6jR49KkmbMmJFou+K34X7//vuv3nrrLVWpUkU5cuSQq6urAgMD1blzZ3NYodTEv+ayZ88uLy8vlSlTRqNHj9bFixfTtHxq7n+vOHXqlN544w2VLl1a2bJlS3J849jYWM2YMUMtW7ZU3rx55erqKj8/P9WuXVsTJkzQjRs3Ul1vXFyc5s6dqw4dOqhAgQJyd3eXu7u7ihUrptDQUM2fPz/ZmzTevn1bX331lerXr6+cOXPKxcVFAQEBat68uWbPnp3i8+BBtveff/7RK6+8osKFC8vNzU158+ZV69at03wMJWnhwoVq27at8ufPL1dXV2XLlk2FCxdWnTp1NHLkyAf+TIh39epVffjhh6pRo4b5XMufP786duyopUuXprjs/a/FEydOaPDgwSpatKjc3d3l5+enJk2a6Jdffnng+CwWiwoVKmT+36tXr0Svo6Tef+Pi4jR79mw1b95cAQEBcnFxUc6cOVW/fn199dVXun37drLrvP8eExcvXtTo0aNVunRpeXl5KUeOHKpfv77mzp2bYuz3f+5u375d3bp1U2BgoNzc3BQYGKhevXrpr7/+SraP9Ixnv3HjRvXu3VvFixeXt7e3XFxclD9/frVs2VJffvmlzV7790s4XEzRokUfuJ+kPmvHjx+vSpUqycfHR97e3qpevbq++uorxcbGptrf2bNn9fbbb6tixYry9fWVm5ubgoKC9Oyzz2rDhg0pLnv/sYuMjNRzzz2nQoUKydXV1YzRYrGofv365nL169dP9Py8/7idPHlSb775prldzs7Oyp07t8qWLatu3bpp+vTpunz5crr3HwAgizAAAECWtXbtWkOSIcmYNm2acfLkScPd3d2QZDRu3DjJZXr27Gkuk5SCBQsakoyePXumuO74fgoWLJhoXkxMjFVc/fr1M/+//9G+fXvj7t27xs2bN42OHTsm2+7FF19MNpb4NqNHjzbCwsKS7cPHx8f4/fffk+0nNjbWGDRokGGxWJLtw8nJyfj666+TXH7atGlmu+3btxsVKlRItPzo0aNT3K9Jef/99w0HB4dkY3J1dTVmzJiR7H5J6ZFeN27cMLp27Zpin56ensbixYsTLbtr1y7D1dXVkGTUqFHDuHv3bqI2q1atMvd/hw4dzOkJ921Kj5iYGHOZevXqGZKMevXqGYsWLTI8PT2TbX/37t0U93H84+mnnzauXLmS4j76+OOPDWdn5xT7qVevXqI409o+3uzZs5PcpoSPF154wbhz506Scd65c8fo1KlTsssWLlzYOHz48EM9dw3D+r1i8+bNhr+/f6J1rV271mx/9OhRo3z58iluV9GiRY39+/cnu86YmJgkX38prTfhsiVKlEhxudq1axvnzp2zyfb+/vvvhre3d7LrCgsLM0aPHp3sa/bu3bspHsf4R+XKldN8zO4XFRVl5M2bN8X+27dvb9y4cSPJ5RO+Fjds2JDkPol/fPzxxw8UY1reH+5/Dp87d86oVatWisuULFnSOHLkSJLrTHhcDh8+bBQpUiTZfjp37pzsazHh5+7UqVMNJyenJPtwdXU1fvjhhyT7uP9zNynXr183unXrlu79dP+2Jtd/al599VWzj4ULFz5QH4Zh/XkQFRVlVK5cOdltqVu3borv2StXrkzx9SfJeOWVV4zY2Ngkl0947CZPnpzksUt4bFJ6JNyvqb0vxD+WLFnywPsRAJC5KLoDAJCF3V90NwzDGDx4sDlt/fr1iZZ51EX36tWrG5KM5s2bGwsWLDAiIyONRYsWmdMlGd9++62ZjHfv3t1YunSpERkZacybN8+q+PXLL78kGUv8/CpVqhiSjOLFixtTp041tm/fbqxevdp46aWXzIKqt7e3cezYsST7efnll60S9e+++86IiIgwtm3bZnz77bdG6dKlzfk///xzouUTFgLKlStnWCwWo0ePHsayZcuMyMhIY+HChcby5ctT3K/3+/LLL80+c+bMaYwfP97YvHmzsWHDBiMsLMwsulosFmPZsmVWy+7evdvYvXu30aZNG0OSkTdvXnNa/CM94uLijBYtWpjxtGrVypg1a5axceNGY/PmzcakSZOMAgUKGJIMFxcXY/v27Yn6+PTTT83lw8LCrOadO3fOLOzlzZvX+O+//8x5Fy5cMHbv3m31Bc7927J7927j9u3b5jLxhb5ChQoZXl5eRs6cOY0PP/zQ2Lhxo7Flyxbj888/N86ePWsYxr0CtIODg9GgQQPj448/NlasWGFERkYaERERxnfffWfUqFHDXG+PHj2S3UfvvPOO2c7X19cYMWKEsWrVKiMqKsr47bffjPH
|
||
|
"text/plain": [
|
||
|
"<Figure size 1700x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Sports\n",
|
||
|
"sport_info_list = [sport24_info, dominika_cibulkova_info, hetrik_info, RTVSsport_info, sagan_info]\n",
|
||
|
"execute_visualisation('Sports', sport_info_list)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABb8AAAHyCAYAAADLDLNCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACsJklEQVR4nOzdd3QU5fv38c+GkJBKIAklEAgQSuhF6V3pvYgiSmgiCFJFga9SRIogoCAgKhIQMBRBEYFIC01KKEGkd0Sa1FATSOb5gyfzy5JCAgmB5f06Z8/JztxzzzWzs5u5rp29x2IYhiEAAAAAAAAAAGyIXXoHAAAAAAAAAABAaqP4DQAAAAAAAACwORS/AQAAAAAAAAA2h+I3AAAAAAAAAMDmUPwGAAAAAAAAANgcit8AAAAAAAAAAJtD8RsAAAAAAAAAYHMofgMAAAAAAAAAbA7FbwAAAAAAAACAzaH4DQCADbNYLLJYLBo2bFh6h/LMio6O1ldffaXy5cvL3d3d3GfNmzdP79DwjOP9lf6GDRtmvg5AQk6ePGkeI0FBQekdDmwAnzsA8Hyh+A0AsEmhoaFmYmKx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qeHt7G2PGjDE2b95sbN261Zg8ebLx33//GYbxoEBiZ2dn1K5d2xg3bpyxcuVKY+fOnUZoaKjxww8/GJUqVTLX2759+0T30aeffmq28/DwMAYPHmysWrXK2LVrl7F27Vrjiy++MCpXrmzUrFnTXOb48ePG3r17zW1v1qxZvO06fvy41Xrmz59vfkm
|
||
|
"text/plain": [
|
||
|
"<Figure size 1700x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# By toppic\n",
|
||
|
"execute_visualisation(None, [politics_info_list, memes_info_list, media_info_list, fame_info_list, sport_info_list])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Language identification"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"lang_identification_pipeline = pipeline(\"text-classification\", model=\"papluca/xlm-roberta-base-language-detection\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 31,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 4%|▍ | 333/8050 [00:17<05:52, 21.91it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (535) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 535]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 26%|██▌ | 2113/8050 [01:53<04:38, 21.31it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (524) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 524]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 77%|███████▋ | 6215/8050 [05:33<01:25, 21.49it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (554) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 554]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 8050/8050 [07:14<00:00, 18.53it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"cibulkova_idxs = np.empty(0, dtype=np.int32)\n",
|
||
|
"\n",
|
||
|
"for idx, text in enumerate(tqdm(dominika_cibulkova_samples)):\n",
|
||
|
" try:\n",
|
||
|
" identified_text = lang_identification_pipeline(text['text'])[0]\n",
|
||
|
" if identified_text['label'] in ['en', 'es'] and identified_text['score'] > 0.70:\n",
|
||
|
" cibulkova_idxs = np.append(cibulkova_idxs, idx)\n",
|
||
|
" except Exception as err:\n",
|
||
|
" print(err)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 41,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 33%|███▎ | 6049/18515 [05:07<09:39, 21.51it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (1268) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 1268]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 51%|█████ | 9469/18515 [07:58<06:49, 22.10it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (1764) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 1764]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 66%|██████▌ | 12208/18515 [10:15<05:12, 20.16it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (1036) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 1036]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 71%|███████ | 13139/18515 [11:02<04:08, 21.62it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (959) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 959]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" 72%|███████▏ | 13298/18515 [11:10<03:59, 21.81it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The expanded size of the tensor (893) must match the existing size (514) at non-singleton dimension 1. Target sizes: [1, 893]. Tensor sizes: [1, 514]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 18515/18515 [15:34<00:00, 19.81it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sagan_idxs = np.empty(0, dtype=np.int32)\n",
|
||
|
"\n",
|
||
|
"for idx, text in enumerate(tqdm(sagan_samples)):\n",
|
||
|
" try:\n",
|
||
|
" identified_text = lang_identification_pipeline(text['text'])[0]\n",
|
||
|
" if identified_text['label'] in ['en', 'es'] and identified_text['score'] > 0.70:\n",
|
||
|
" sagan_idxs = np.append(sagan_idxs, idx)\n",
|
||
|
" except Exception as err:\n",
|
||
|
" print(err)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Dropping english and spannish data from famous slovak sportsmen"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 44,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"cibulkova_idxs_reversed = cibulkova_idxs[::-1]\n",
|
||
|
"for idx in cibulkova_idxs_reversed:\n",
|
||
|
" dominika_cibulkova_samples.pop(idx)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 46,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sagan_idxs_reversed = sagan_idxs[::-1]\n",
|
||
|
"for idx in sagan_idxs_reversed:\n",
|
||
|
" sagan_samples.pop(idx)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 48,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with open('clustered_jsonl/dominika_slovak.jsonl', 'w') as f:\n",
|
||
|
" for item in dominika_cibulkova_samples:\n",
|
||
|
" json.dump(item, f)\n",
|
||
|
" f.write('\\n')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Get number of posts in the data"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def get_num_of_posts(data: list, info: dict):\n",
|
||
|
" return len([item for item in data if item['id'] in info['post_ids']])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Data merging"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Meme data merging"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"meme_samples_final = []\n",
|
||
|
"\n",
|
||
|
"meme_samples_final += zomri_samples\n",
|
||
|
"meme_samples_final += emefka_samples\n",
|
||
|
"\n",
|
||
|
"# ok ale ides prvy dont consist any type of criticism or hate\n",
|
||
|
"post_meme = get_num_of_posts(zomri_samples, zomri_info) + get_num_of_posts(emefka_samples, emefka_info)\n",
|
||
|
"meme_share = len(meme_samples_final)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Media data merging"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"media_samples_final = []\n",
|
||
|
"\n",
|
||
|
"eva_hate = eva_samples[250: 387]\n",
|
||
|
"\n",
|
||
|
"eva_hate_1 = eva_samples[700:]\n",
|
||
|
"\n",
|
||
|
"media_samples_final += eva_hate\n",
|
||
|
"media_samples_final += eva_hate_1\n",
|
||
|
"media_samples_final += aktuality_samples\n",
|
||
|
"media_samples_final += dennikN_samples\n",
|
||
|
"media_samples_final += tvJOJ_samples\n",
|
||
|
"\n",
|
||
|
"post_media = get_num_of_posts(eva_hate, eva_info) + get_num_of_posts(eva_hate_1, eva_info) + get_num_of_posts(aktuality_samples, aktuality_info) + get_num_of_posts(dennikN_samples, dennikN_info) + get_num_of_posts(tvJOJ_samples, tvJOJ_info)\n",
|
||
|
"media_share = len(media_samples_final)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Famous people data merging"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 16,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"famous_samples_final = []\n",
|
||
|
"\n",
|
||
|
"# jan_kolenik_samples he has just possitive conversations on his profile\n",
|
||
|
"famous_samples_final += sajfa_samples[:240]\n",
|
||
|
"# peter_marcin_samples has also positive conversations\n",
|
||
|
"\n",
|
||
|
"post_fame = get_num_of_posts(sajfa_samples[:240], sajfa_info)\n",
|
||
|
"fame_share = len(famous_samples_final)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Sports"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sport_samples_final = []\n",
|
||
|
"\n",
|
||
|
"sport_samples_final += sport24_samples\n",
|
||
|
"sport_samples_final += RTVSsport_samples\n",
|
||
|
"\n",
|
||
|
"post_sport = get_num_of_posts(sport24_samples, sport24_info) + get_num_of_posts(RTVSsport_samples, RTVSsport_info)\n",
|
||
|
"sport_share = len(sport_samples_final)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Politician data merging"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"politican_samples_final = []\n",
|
||
|
"\n",
|
||
|
"# fico_samples\n",
|
||
|
"politican_samples_final += ekalinak_samples\n",
|
||
|
"politican_samples_final += kotleba_samples\n",
|
||
|
"politican_samples_final += fico_samples[:50000]\n",
|
||
|
"\n",
|
||
|
"post_politics = get_num_of_posts(ekalinak_samples, ekalinak_info) + get_num_of_posts(kotleba_samples, kotleba_info) + get_num_of_posts(fico_samples[:50000], fico_info)\n",
|
||
|
"politics_share = len(politican_samples_final)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Pie chart of data ratio in dataset"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcoAAAGbCAYAAABETtCOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB/M0lEQVR4nO3dd1xW5f/H8dd9s/ceCigioCgu3HtvTcsyV0qmpm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zq4BWq8XDw+Oe9YD73lYQFxdHSkoKvr6+xdb84YcfkpSUhLe3Nw0aNOCtt97i3LlzxT6nOK6urgUhfIeNjQ2JiYmPvc37qVGjxj37AQrt69ChQ3Tr1g0zMzOsra1xcHBg+vTpwKO/J++8n2rXrl1oeVHvz8zMTD744APc3NwwMjLC3t4eBwcHkpKSHnq/Fy9e5Omnn8bKygpLS0scHBwKPoTc2UatWrV44403+P7777G3t6dnz5588803hfYRHByMoih4eXnh4OBQ6CsgIIAbN2480utQ1ck1SvHQ7v60e8fgwYM5fPgwb731Fo0bN8bc3BydTkevXr3Q6XQqVHnLf/9wi3916NCBkJAQNm7cyPbt2/n+++/58ssvWbJkCWPGjHnk7enp6RW5XLl9HbskPWhfISEhdO3albp16/LFF1/g5uaGoaEhW7Zs4csvvyzV9+Srr77K8uXLmTJlCq1bt8bKygqNRsOQIUMear9JSUl07NgRS0tLPvzwQ2rXro2xsTGnTp3inXfeKbSNefPm4e/vX/A7nDx
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.pie(\n",
|
||
|
" [meme_share, media_share, fame_share, sport_share, politics_share],\n",
|
||
|
" labels=['Memes', 'Medias', 'Famous people', 'Sports', 'Politicians'],\n",
|
||
|
" autopct='%1.1f%%',\n",
|
||
|
" wedgeprops= {\n",
|
||
|
" 'edgecolor': 'BLACK'\n",
|
||
|
" },\n",
|
||
|
" colors=[BLUE, GREEN, AQUA, ORANGE, YELLOW]\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"plt.title('ratio of toppics in final dataset')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 20,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"final_dataset = []\n",
|
||
|
"\n",
|
||
|
"final_dataset += meme_samples_final\n",
|
||
|
"final_dataset += media_samples_final\n",
|
||
|
"final_dataset += famous_samples_final\n",
|
||
|
"final_dataset += sport_samples_final\n",
|
||
|
"final_dataset += politican_samples_final\n",
|
||
|
"\n",
|
||
|
"final_post_num = post_fame + post_media + post_meme + post_sport + post_politics"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Dataset has 171579 samples. 468 are posts out of it.\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(f'Dataset has {len(final_dataset)} samples. {final_post_num} are posts out of it.')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Pie chart of post ratio in the dataset"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 73,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAdgAAAGbCAYAAABnFYFbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB9kElEQVR4nO3dd3xN9x/H8dfN3iLbCBGCiD1ib7VD7CpqbzVqVVtbKb+qWbNmzdqjRlFU1SaoGSGxEyQiMm/uPb8/wq00tsTJ+DwfjzySnHvG50Tkfb/f8z3fo1EURUEIIYQQqcpI7QKEEEKIzEgCVgghhEgDErBCCCFEGpCAFUIIIdKABKwQQgiRBiRghRBCiDQgASuEEEKkAQlYIYQQIg1IwAohhBBpQAI2nfH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AALt372bnzp3s3LmTJUuW8Pnnn7Ns2bLXbqvRaFi/fj1Hjx5l27Zt7N69my5dujB16lSOHj2KjY3NO9djbGz80uXKs2vtqeVtjvPFF1+wZMkSBg4cSMWKFcmWLRsajYZPP/00TX+ngoKCqF27NoULF+bHH3/E3d0dMzMzduzYwbRp097q2BMnTmTkyJF06dKF8ePH4+DggJGREQMHDky2vbe3N1euXGH79u3s2rWLDRs2MGfOHEaNGsXYsWMN67Zv356OHTu+9FjFixdPnRMXIhVJwKaSiIgI9u3bx9ixYxk1apRheWBgYIp13yXw8ubNy5UrV1Isv3z5suH1122r1+sJDAw0tBohacDI48ePP2gShLt376a4Penq1atA0mxUz49/7tw
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.pie(\n",
|
||
|
" [post_fame, post_media, post_meme, post_sport, post_politics],\n",
|
||
|
" labels=['Famous people', 'Medias', 'Memes', 'Sports', 'Politicians'],\n",
|
||
|
" autopct='%1.1f%%',\n",
|
||
|
" wedgeprops= {\n",
|
||
|
" 'edgecolor': 'BLACK'\n",
|
||
|
" },\n",
|
||
|
" colors=[BLUE, GREEN, AQUA, ORANGE, YELLOW]\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"plt.title('ratio of posts in final dataset')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# GDPR protection"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"GDPR_final = final_dataset.copy()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 24,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"author_mapping = {}\n",
|
||
|
"idx = 1\n",
|
||
|
"for sample in final_dataset:\n",
|
||
|
" author = sample['author'].lower()\n",
|
||
|
" if author not in author_mapping:\n",
|
||
|
" author_mapping[author] = f'user{idx}'\n",
|
||
|
" idx += 1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 25,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 47254/47254 [00:00<00:00, 2697741.07it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"keys_to_delete = []\n",
|
||
|
"for key in tqdm(author_mapping.keys()):\n",
|
||
|
" if len(key) < 7:\n",
|
||
|
" keys_to_delete.append(key)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 26,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"for key in keys_to_delete:\n",
|
||
|
" del author_mapping[key]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 28,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 171579/171579 [1:01:55<00:00, 46.18it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for sample in tqdm(final_dataset):\n",
|
||
|
" author = sample['author'].lower()\n",
|
||
|
" if author in author_mapping:\n",
|
||
|
" sample['author'] = author_mapping[author]\n",
|
||
|
" \n",
|
||
|
" for key in author_mapping:\n",
|
||
|
" sample['text'] = sample['text'].lower().replace(key, author_mapping[key])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 39,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with open('final.jsonl', 'w') as f:\n",
|
||
|
" for item in final_dataset:\n",
|
||
|
" json.dump(item, f)\n",
|
||
|
" f.write('\\n')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### ID appending"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 171579/171579 [00:00<00:00, 2332284.88it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"id = 1\n",
|
||
|
"for item in tqdm(final_dataset):\n",
|
||
|
" item['id'] = id\n",
|
||
|
" id += 1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 31,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with open('final_id_v2.jsonl', 'w') as f:\n",
|
||
|
" for item in final_dataset:\n",
|
||
|
" json.dump(item, f)\n",
|
||
|
" f.write('\\n')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Sentiment data reducing"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 32,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sentiment_pipe = pipeline(\"text-classification\", model=\"kinit/slovakbert-sentiment-twitter\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 46,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 344/344 [2:30:05<00:00, 26.18s/it] \n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"positive_samples = []\n",
|
||
|
"negative_samples = []\n",
|
||
|
"neutral_samples = []\n",
|
||
|
"\n",
|
||
|
"# Batch processing for efficiency\n",
|
||
|
"batch_size = 500\n",
|
||
|
"batched_texts = [final_dataset[i:i + batch_size] for i in range(0, len(final_dataset), batch_size)]\n",
|
||
|
"\n",
|
||
|
"for batch in tqdm(batched_texts):\n",
|
||
|
" try:\n",
|
||
|
" sentiments = sentiment_pipe([sample['text'] for sample in batch])\n",
|
||
|
" for sample, sentiment in zip(batch, sentiments):\n",
|
||
|
" sentiment_val = sentiment['label']\n",
|
||
|
" if sentiment_val == '1':\n",
|
||
|
" positive_samples.append(sample)\n",
|
||
|
" continue\n",
|
||
|
" elif sentiment_val == '0':\n",
|
||
|
" neutral_samples.append(sample)\n",
|
||
|
" continue\n",
|
||
|
" negative_samples.append(sample)\n",
|
||
|
" except Exception as err:\n",
|
||
|
" pass"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 52,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with open('classified_data/neutral_v1.jsonl', 'w') as f:\n",
|
||
|
" for item in neutral_samples:\n",
|
||
|
" json.dump(item, f)\n",
|
||
|
" f.write('\\n')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Merging classified data"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 68,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def load_jsonl(file_path):\n",
|
||
|
" with open(file_path, 'r', encoding='utf-8') as file:\n",
|
||
|
" return [json.loads(line) for line in file]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 130,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"positive_samples = load_jsonl('classified_data/positive.jsonl')\n",
|
||
|
"negative_samples = load_jsonl('classified_data/negative.jsonl')\n",
|
||
|
"neutral_samples = load_jsonl('classified_data/neutral.jsonl')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 53,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAGbCAYAAADeN3riAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACCwElEQVR4nO3dd1QUVxsG8GcLZem9iiBVOiqigoAFBQsKsWtU7MYWa2yJPRo1xZJYY9cYu9FobCj2roAVsSBFpIM0Kbv3+8OPTVZAQYFh4f2dw1FmZ+88szs7vHvnzgyPMcZACCGEECKH+FwHIIQQQgj5VFTIEEIIIURuUSFDCCGEELlFhQwhhBBC5BYVMoQQQgiRW1TIEEIIIURuUSFDCCGEELlFhQwhhBBC5BYVMoQQQgiRW3WmkJk3bx54PB4ny7558yY8PT2hqqoKHo+H8PBwTnLUhDZt2qBNmzZcx6hVYmJiwOPxsHXrVuk0LrfHmrZ161bweDzcunWL6yg1KiwsDDweD2FhYVxHqXY8Hg/z5s2r0WWW9bmqjapi/29hYYGuXbtWfbh6otoKmZKdW8mPUCiEqakpQkJCkJCQ8Elt5uXlYd68ebVqx1FUVIRevXohPT0dv/zyC3bs2AFzc3OuY5F67I8//sCKFSuqvN01a9bU+j8q1UHe17u6tg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z17VrqjeF/JOkdHRzM+n8+Cg4NLjVcomSc5OZkpKiqyjh07ysxTUlhv3rxZOs3X15cBYOvWrZNp6/DhwwwAW7Zsmcx6lBQDFSlkFBUV2dOnT6XTIiIiGACZoiwwMJCpqKj
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.pie(\n",
|
||
|
" [len(positive_samples), len(negative_samples), len(neutral_samples)],\n",
|
||
|
" labels=['Positive samples', 'Negative samples', 'Neutral samples'],\n",
|
||
|
" autopct='%1.1f%%',\n",
|
||
|
" wedgeprops= {\n",
|
||
|
" 'edgecolor': 'BLACK'\n",
|
||
|
" },\n",
|
||
|
" colors=[BLUE, GREEN, AQUA]\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"plt.title('Ratio of records according to the sentimental value of the text')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Extracting samples with swear words"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 54,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def find_word(words: list, sample: str):\n",
|
||
|
"\n",
|
||
|
" for word in words:\n",
|
||
|
" if re.search(r'\\b' + word + r'\\b', sample.lower()) is not None:\n",
|
||
|
" return True\n",
|
||
|
" return False"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 55,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"swear_words = (\n",
|
||
|
" 'kokot',\n",
|
||
|
" 'kkt',\n",
|
||
|
" 'koko*',\n",
|
||
|
" 'pi.',\n",
|
||
|
" 'pi*'\n",
|
||
|
" 'pic',\n",
|
||
|
" 'pič',\n",
|
||
|
" 'sedl',\n",
|
||
|
" 'hovn',\n",
|
||
|
" 'retard',\n",
|
||
|
" 'bastard',\n",
|
||
|
" 'idiot',\n",
|
||
|
" 'kurv',\n",
|
||
|
" 'geň',\n",
|
||
|
" 'geno',\n",
|
||
|
" 'riť',\n",
|
||
|
" 'rit',\n",
|
||
|
" 'anal',\n",
|
||
|
" 'jeb',\n",
|
||
|
" 'curak',\n",
|
||
|
" 'čur',\n",
|
||
|
" 'chuj',\n",
|
||
|
" 'srack',\n",
|
||
|
" 'srač',\n",
|
||
|
" 'hoveda',\n",
|
||
|
" 'hovada',\n",
|
||
|
" 'hoväd',\n",
|
||
|
" 'cigan',\n",
|
||
|
" 'cigán',\n",
|
||
|
" 'neger',\n",
|
||
|
" 'negri',\n",
|
||
|
" 'blaznov',\n",
|
||
|
" 'bláznov',\n",
|
||
|
" 'blazon',\n",
|
||
|
" 'blázon',\n",
|
||
|
" 'krist',\n",
|
||
|
" 'hajz',\n",
|
||
|
" 'stet',\n",
|
||
|
" 'štet',\n",
|
||
|
" 'sex',\n",
|
||
|
" 'gay',\n",
|
||
|
" 'gej',\n",
|
||
|
" 'buzerant',\n",
|
||
|
" 'buzik',\n",
|
||
|
" 'tepl',\n",
|
||
|
" 'hanb',\n",
|
||
|
" 'hamb',\n",
|
||
|
" 'nigg',\n",
|
||
|
" 'uchyl',\n",
|
||
|
" 'uchil',\n",
|
||
|
" 'hnus',\n",
|
||
|
" 'potkan',\n",
|
||
|
" 'trapn',\n",
|
||
|
" 'odpad',\n",
|
||
|
" 'zmrd',\n",
|
||
|
" 'drog',\n",
|
||
|
" 'zlatok',\n",
|
||
|
" 'vymydl',\n",
|
||
|
" 'mrch',\n",
|
||
|
" 'fet',\n",
|
||
|
" 'zbabelec',\n",
|
||
|
" 'psycho',\n",
|
||
|
" 'k.k.t',\n",
|
||
|
" 'maria',\n",
|
||
|
" 'mariu',\n",
|
||
|
" 'svin',\n",
|
||
|
" 'egocent',\n",
|
||
|
" 'chuda',\n",
|
||
|
" 'bit',\n",
|
||
|
" 'nasilnik',\n",
|
||
|
" 'spodina',\n",
|
||
|
" 'spo.dina',\n",
|
||
|
" 'magor',\n",
|
||
|
" 'tyran',\n",
|
||
|
" 'tiran',\n",
|
||
|
" 'boha',\n",
|
||
|
" 'spina',\n",
|
||
|
" 'dement',\n",
|
||
|
" 'hnoj',\n",
|
||
|
" 'dobil',\n",
|
||
|
" 'psicho',\n",
|
||
|
" 'hajzl',\n",
|
||
|
" 'komediant',\n",
|
||
|
" 'nechutny',\n",
|
||
|
" 'sprostak',\n",
|
||
|
" 'mafia',\n",
|
||
|
" 'cecky',\n",
|
||
|
" 'ser',\n",
|
||
|
" 'vola',\n",
|
||
|
" 'klam',\n",
|
||
|
" 'cirkus',\n",
|
||
|
" 'huba',\n",
|
||
|
" 'huby',\n",
|
||
|
" 'trtko',\n",
|
||
|
" 'trtkat',\n",
|
||
|
" 'o.e'\n",
|
||
|
")\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 56,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"neg_swear_samples = []\n",
|
||
|
"pos_swear_samples = []\n",
|
||
|
"neu_swear_samples = []"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 57,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 111568/111568 [00:18<00:00, 6070.15it/s]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"3485"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 57,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for sample in tqdm(negative_samples):\n",
|
||
|
" if find_word(swear_words, sample['text']):\n",
|
||
|
" neg_swear_samples.append(sample)\n",
|
||
|
"\n",
|
||
|
"len(neg_swear_samples)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 58,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 34083/34083 [00:04<00:00, 7840.59it/s]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"182"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 58,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for sample in tqdm(positive_samples):\n",
|
||
|
" if find_word(swear_words, sample['text']):\n",
|
||
|
" pos_swear_samples.append(sample)\n",
|
||
|
"\n",
|
||
|
"len(pos_swear_samples)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 59,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 11428/11428 [00:00<00:00, 11980.43it/s]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"79"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 59,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for sample in tqdm(neutral_samples):\n",
|
||
|
" if find_word(swear_words, sample['text']):\n",
|
||
|
" neu_swear_samples.append(sample)\n",
|
||
|
"\n",
|
||
|
"len(neu_swear_samples)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 60,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def get_samples_without_swear_words(samples: list, swear_samples: list):\n",
|
||
|
" return [item for item in samples if item not in swear_samples]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 61,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"positive_without_swear = get_samples_without_swear_words(positive_samples, pos_swear_samples)\n",
|
||
|
"negative_without_swear = get_samples_without_swear_words(negative_samples, neg_swear_samples)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 62,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def get_random_samples_by_len(samples: list, length: int):\n",
|
||
|
" random.shuffle(samples)\n",
|
||
|
" return samples[:length]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Computing sample percentage"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 63,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"11428"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 63,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"len(neutral_samples) # 20 % of the data\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 64,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"shuffled_positive_data = get_random_samples_by_len(positive_without_swear, len(neutral_samples) - len(pos_swear_samples)) # other 20% the same as neutral data"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 65,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"shuffled_negative_data = get_random_samples_by_len(negative_without_swear, int((((2 * len(neutral_samples)) / 40) * 60)) - len(neg_swear_samples)) # next 60%"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 66,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"34284"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 66,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"len(shuffled_negative_data) + len(neg_swear_samples)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Final dataset merge"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 67,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"classified_data = []\n",
|
||
|
"\n",
|
||
|
"def append_final(input_list: list):\n",
|
||
|
" for sample in input_list:\n",
|
||
|
" classified_data.append(sample)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"append_final(neutral_samples)\n",
|
||
|
"append_final(pos_swear_samples)\n",
|
||
|
"append_final(shuffled_positive_data)\n",
|
||
|
"append_final(neg_swear_samples)\n",
|
||
|
"append_final(shuffled_negative_data)\n",
|
||
|
"\n",
|
||
|
"random.shuffle(classified_data)\n",
|
||
|
"\n",
|
||
|
"id = 1\n",
|
||
|
"for sample in classified_data:\n",
|
||
|
" sample['id'] = id\n",
|
||
|
" id += 1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 68,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"57140"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 68,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"len(classified_data)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 69,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAGbCAYAAADqTrv+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB3h0lEQVR4nO3dd1iV9f/H8ec5HA57T0H2cE/cO7XEHGlmppbatjRzZtORfTVbmpaZDUeZWebee+8JIioiQwVFQWTv+/eHyS8CzQHcB3g/rourvM997vt1jkd4cX8+931rFEVREEIIIYQwQFq1AwghhBBC3I0UFSGEEEIYLCkqQgghhDBYUlSEEEIIYbCkqAghhBDCYElREUIIIYTBkqIihBBCCIMlRUUIIYQQBkuKihBCCCEMlhQVUSV5e3szZMgQVfb9+eef4+vri5GREQ0bNnzg53fo0IEOHTqUeq6HFR0djUajYcGCBWW+rwULFqDRaDh69GiZ7ysiIoInnngCGxsbNBoNK1euLNx/dHR0me33Ud/P8sgoRHmSoiIqrf379zNp0iSSk5PVjlJo8+bNvPPOO7Ru3Zr58+czderUctt3RkYGkyZNYufOneW2z4c1Z86ccik+9zJ48GBCQ0P53//+xy+//EKTJk1UzVMefvvtN2bOnKl2DKBifV5F2dKpHUCIsrJ//34mT57MkCFDsLW1LfLYuXPn0GrLv6dv374drVbLTz/9hF6vL9d9Z2RkMHnyZIBSPSLj5eVFZmYmxsbGpbbNOXPm4OjoqNpRr8zMTA4cOMAHH3zA8OHDC5e/8MILPPfcc5iYmKiSq6z99ttvnD59mpEjR6odpcw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kCDY2NkXWNTIyKlynoKCApKQk8vLyaNKkyX2/H2XxnkLxv7+2bdty8eLFh97eHa+99lqRozxt27YlPz+fmJgY4PZv9snJyfTv358bN24UfhkZGdG8efMShyweRe3atWnbtm3hn52cnKhRo0aR12piYlI4gTs/P5/ExEQsLS2pUaPGQ73H69evp0WLFjRr1qzIfgcOHFhs3X/+/aampnLjxg3atm1LRkYGZ8+e/c993e9nzNbWlvT0dLZs2XLXbf3555+0bdsWOzu7In83nTt3Jj8/n927d9/X6xdVhwz9CIPm4+NTbFlSUhKTJ0/m999/JyEhochjt27deqj9xMTE0Lx582LLa9WqVfh43bp17/pcrVaLv79/keWurq7Y2toW/vB80DwAAQEBRZYbGxvj6+tbbP2FCxfy5ZdfcvbsWXJzcwuXl/T+laQs3lNTU9NiQ212dnbcvHnzobb3T56ensW2CxRuOyIiAoCOHTuW+Hxra+tHznCvPHcy/fO1FhQU8PXXXzNnzhyioqKKzA9xcHB44H3e7TNbo0aNYsvCwsL48MMP2b59OykpKUUeu9+/3/v5jL355pv88ccfdO3aFXd3d5544gmeffZZgoODC9eJiIggJCTkrsOw//78CSFFRRi0ksbbn332Wfbv38+4ceNo2LAhlpaWFBQUEBwcXOJEwvLyMPM4SsOvv/7KkCFD6NWrF+PGjcPZ2RkjIyOmTZtGZGTkfW2jLN7Tsjw75m7bVv6ex3Qn8y+//IKrq2ux9XS60v3W9195AKZOncpHH33ESy+9xJQpU7C3t0er1TJy5Mgy/dwmJyfTvn17rK2t+fjjj/Hz88PU1JTjx48zfvz4+9r3/X7GnJ2dOXnyJJs2bWLDhg1s2LCB+fPnM2jQIBYuXAjc/rt5/PHHeeedd0rcV2BgYOm8cFFpSFERFcrNmzfZtm0bkydPZsKECYXL7/wG/U8PUhy8vLw4d+5cseV3DovfOQvkbs8tKCggIiKi8AgM3J6gm5ycfM/n3mu
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.pie(\n",
|
||
|
" [len(shuffled_positive_data) + len(pos_swear_samples), len(shuffled_negative_data) + len(neg_swear_samples), len(neutral_samples)],\n",
|
||
|
" labels=['Positive samples', 'Negative samples', 'Neutral samples'],\n",
|
||
|
" autopct='%1.1f%%',\n",
|
||
|
" wedgeprops= {\n",
|
||
|
" 'edgecolor': 'BLACK'\n",
|
||
|
" },\n",
|
||
|
" colors=[BLUE, GREEN, AQUA]\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"plt.title('ratio of data in the final dataset')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 70,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkYAAAGbCAYAAAAhlV8AAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB0ZElEQVR4nO3dd1yU9QMH8M/dcexx7D0FHCiKe+FEcY9cqWU4Misz22n91JZmS9NylmZlWVmpufdeuGUIyAaRJXveeH5/gJcEKirwMD7v18uX+txzz33uOOBz3+f7PI9EEAQBRERERASp2AGIiIiI6gsWIyIiIqJyLEZERERE5ViMiIiIiMqxGBERERGVYzEiIiIiKsdiRERERFSOxYiIiIioHIsRERERUTkWI2o03NzcEBQUJMpjf/755/Dw8IBMJkO7du1EyVCbJBIJFi1aJHaMh1q0aBEkEskjrZuRkVHLqehJPcrXlehJsRhRg3L69GksWrQI2dnZYkfR2r9/P95++2306NEDGzduxOLFi8WORPdYvHgxtm3bJnYMImogWIyoQTl9+jQ++OCDKotRREQE1q9fX+eZDh8+DKlUiu+//x5TpkzBkCFD6jwDlXn//f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+4PuK5VK4enpWWG5nZ0dFArFA+97P+7u7nj99dfx3XffwcrKCoGBgfj2228rPb9Tp04hICAARkZGUCgUsLa21s6d+O+69/4CAf79he3s7Fzl8qysrArLpVIpPDw8Kizz9vYGAO3crf9KT09HdnY21q1bB2tr6wp/pk6dCqBsrgkAvPP
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.pie(\n",
|
||
|
" [len(pos_swear_samples), len(neg_swear_samples), len(neu_swear_samples)],\n",
|
||
|
" labels=['Positive samples', 'Negative samples', 'Neutral samples'],\n",
|
||
|
" autopct='%1.1f%%',\n",
|
||
|
" wedgeprops= {\n",
|
||
|
" 'edgecolor': 'BLACK'\n",
|
||
|
" },\n",
|
||
|
" colors=[BLUE, GREEN, AQUA]\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"plt.title('ratio of samples with swear words')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 71,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with open('final_id_v2.jsonl', 'w') as f:\n",
|
||
|
" for item in classified_data:\n",
|
||
|
" json.dump(item, f)\n",
|
||
|
" f.write('\\n')"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "sentiment",
|
||
|
"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.9.16"
|
||
|
},
|
||
|
"orig_nbformat": 4
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|