{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0",
   "metadata": {},
   "outputs": [],
   "source": [
    "from suno_utils.utils.text import read_jsonl, write_jsonl\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1",
   "metadata": {},
   "outputs": [],
   "source": [
    "beatport_mashups_maybe = read_jsonl(\"mashup_beatport_match_test.jsonl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2",
   "metadata": {},
   "outputs": [],
   "source": [
    "beatport_mashups_maybe[0].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3",
   "metadata": {},
   "outputs": [],
   "source": [
    "beatport_mashups_maybe[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4",
   "metadata": {},
   "outputs": [],
   "source": [
    "mashup_keywords = {}\n",
    "mashup_sources = {}\n",
    "\n",
    "for meta in beatport_mashups_maybe:\n",
    "    mashup_keyword = meta['scores']['mashup_keyword']\n",
    "    known_mashup_source = meta['scores']['known_mashup_source']\n",
    "    if mashup_keyword is not None:\n",
    "        if mashup_keyword not in mashup_keywords:\n",
    "            mashup_keywords[mashup_keyword] = 0\n",
    "        mashup_keywords[mashup_keyword] += 1\n",
    "\n",
    "    if known_mashup_source is not None:\n",
    "        if known_mashup_source not in mashup_sources:\n",
    "            mashup_sources[known_mashup_source] = 0\n",
    "        mashup_sources[known_mashup_source] += 1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5",
   "metadata": {},
   "outputs": [],
   "source": [
    "mashup_keywords = sorted(mashup_keywords.items(), key=lambda x: x[1], reverse=True)\n",
    "mashup_keywords"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6",
   "metadata": {},
   "outputs": [],
   "source": [
    "mashup_sources = sorted(mashup_sources.items(), key=lambda x: x[1], reverse=True)\n",
    "mashup_sources"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7",
   "metadata": {},
   "outputs": [],
   "source": [
    "beatport_raw = read_jsonl(\"/home/sara/task_data/beatport_metadata_raw.jsonl\")\n",
    "beatport_raw[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8",
   "metadata": {},
   "outputs": [],
   "source": [
    "remixes = 0\n",
    "mashups = 0\n",
    "for entry in beatport_raw:\n",
    "    name = entry['title']\n",
    "    if \"mashup\" in name.lower():\n",
    "        mashups += 1\n",
    "    if \"remix\" in name.lower():\n",
    "        remixes += 1\n",
    "\n",
    "print(f\"Mashups: {mashups}\")\n",
    "print(f\"Remixes: {remixes}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "suno_clean",
   "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.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
