{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6ac9c794",
   "metadata": {},
   "source": [
    "### Southern Comfort"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4ebd702c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# run the pipeline\n",
    "python -m suno_utils.scripts.rev_podcast.run \\\n",
    "    --output_dir=/tmp/georg_southern \\\n",
    "    --ngpu=1 \\\n",
    "    --conda-env=mfa \\\n",
    "    --conda_sh_filepath=/home/georg/anaconda3/etc/profile.d/conda.sh \\\n",
    "    --mfa_dictionary_name english \\\n",
    "    --mfa_acoustic_model_name english \\\n",
    "    --num_cores_mfa=20 \\\n",
    "    --manifest_file=/tmp/foobar/output/00_manifest.json \\\n",
    "    --dataset_name=southern_comfort \\\n",
    "    --s3_sample_data_prefix=s3://suno-static-public/datasets/southern-comfort/sample-data/segments/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "efbed978",
   "metadata": {},
   "outputs": [],
   "source": [
    "# # remove sample 5\n",
    "# import json\n",
    "# with open(\"/tmp/georg_southern/artifacts/web-sample-data/sample_manifest_web.json\") as f:\n",
    "#     d = json.load(f)\n",
    "# del d[\"sample\"][5]\n",
    "# with open(\"/tmp/georg_southern/artifacts/web-sample-data/sample_manifest_web.json\", \"w\") as f:\n",
    "#     json.dump(d, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "49100414",
   "metadata": {},
   "outputs": [],
   "source": [
    "# move to a sane place if it worked\n",
    "mv /tmp/georg_southern /mnt/data-ssd-1/data/southern-comfort/output\n",
    "\n",
    "# upload the downloadable samples\n",
    "aws s3 cp \\\n",
    "    --acl public-read /mnt/data-ssd-1/data/southern-comfort/output/artifacts/data_sample.tar.gz \\\n",
    "    s3://suno-static-public/datasets/southern-comfort/southern_comfort_sample.tar.gz\n",
    "\n",
    "# upload the web FE samples\n",
    "aws s3 cp \\\n",
    "    --acl public-read \\\n",
    "    --recursive /mnt/data-ssd-1/data/southern-comfort/output/artifacts/web-sample-data/ \\\n",
    "    s3://suno-static-public/datasets/southern-comfort/sample-data"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9aff7e0d",
   "metadata": {},
   "source": [
    "### GData Mate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "894ac38d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# run the pipeline\n",
    "python -m suno_utils.scripts.rev_podcast.run \\\n",
    "    --output_dir=/tmp/georg_gdata \\\n",
    "    --ngpu=1 \\\n",
    "    --conda-env=mfa \\\n",
    "    --conda_sh_filepath=/home/georg/anaconda3/etc/profile.d/conda.sh \\\n",
    "    --mfa_dictionary_name english \\\n",
    "    --mfa_acoustic_model_name english \\\n",
    "    --num_cores_mfa=20 \\\n",
    "    --manifest_file=/mnt/data-ssd-1/data/gdata-mate/output/00_segment_manifest.json \\\n",
    "    --dataset_name=gdata_mate \\\n",
    "    --s3_sample_data_prefix=s3://suno-static-public/datasets/gdata-mate/sample-data/segments/\n",
    "    \n",
    "# move to a sane place if it worked\n",
    "mv /tmp/georg_gdata /mnt/data-ssd-1/data/gdata-mate/output\n",
    "\n",
    "# upload the downloadable samples\n",
    "aws s3 cp \\\n",
    "    --acl public-read /mnt/data-ssd-1/data/gdata-mate/output/artifacts/data_sample.tar.gz \\\n",
    "    s3://suno-static-public/datasets/gdata-mate/gdata_mate_sample.tar.gz\n",
    "\n",
    "# upload the web FE samples\n",
    "aws s3 cp \\\n",
    "    --acl public-read \\\n",
    "    --recursive /mnt/data-ssd-1/data/gdata-mate/output/artifacts/web-sample-data/ \\\n",
    "    s3://suno-static-public/datasets/gdata-mate/sample-data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "48eef4ff",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "13f5dad8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d733bf59",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dbe016da",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7d80eef1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3c0c1b17",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9d3eb567",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "90c97589",
   "metadata": {},
   "source": [
    "## Playground"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "4fcbe718",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "with open(\"/tmp/georg_pipeline_test/artifacts/02_segment_meta_post_norm_and_asr.json\") as f:\n",
    "    d = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6f49b20f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "149\n"
     ]
    }
   ],
   "source": [
    "for n, e in enumerate(d):\n",
    "#     break\n",
    "    if e[\"transcript\"][\"tokens\"][0][\"value\"] == \"Nathan\":\n",
    "        print(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "bc8f4bea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['source_audio_offset_s', 'id', 'uri', 'duration_s', 'transcript', 'ignore_segment', 'source_audio_uri', 'source_audio_id', 'source_transcript_id', 'source_transcript_uri', 'transcript_normalized', 'transcript_asr'])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[149].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "1eb9488d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['tokens'])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[149][\"transcript\"].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8c4e28d2",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4db0a992",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ae5bc038",
   "metadata": {},
   "outputs": [],
   "source": [
    "from suno_utils.audio.data_model import Tokens"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "15910fb9",
   "metadata": {},
   "outputs": [],
   "source": [
    "transcript_tokens = Tokens.from_dict(d[149][\"transcript\"][\"tokens\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "92587041",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[\"Nathan on his normal schedule. He's still got enough days off in between, uh, and he's also -- He does real well at home. So might as well utilize that home field advantage to your favor.\",\n",
       " \"Scott, something that, uh, Chip is gonna do for all of our listeners if you're already tuning in.\"]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[t[\"text\"] for t in transcript_tokens.speaker_turns]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e93f73fd",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f3729ad6",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "69456fe0",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "with open(\"/mnt/data-ssd-1/data/southern-comfort/bk_output/artifacts/web-sample-data/sample_manifest_web.json\") as f:\n",
    "    d_old = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "8927792d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'text': \"Nathan on his normal schedule. He's still got enough days off in between, uh, and he's also -- He does real well at home. So might as well utilize that home field advantage to your favor.\",\n",
       "  'speaker': 'Speaker_0',\n",
       "  'tokens': [{'start_s': 0.0,\n",
       "    'end_s': 0.22,\n",
       "    'value': 'Nathan',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 0.22,\n",
       "    'end_s': 0.36,\n",
       "    'value': 'on',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 0.36,\n",
       "    'end_s': 0.65,\n",
       "    'value': 'his',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 0.65,\n",
       "    'end_s': 0.8,\n",
       "    'value': 'normal',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 0.8,\n",
       "    'end_s': 1.16,\n",
       "    'value': 'schedule.',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 1.16,\n",
       "    'end_s': 1.48,\n",
       "    'value': \"He's\",\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 1.48,\n",
       "    'end_s': 1.66,\n",
       "    'value': 'still',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 1.66,\n",
       "    'end_s': 1.87,\n",
       "    'value': 'got',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 1.87,\n",
       "    'end_s': 2.04,\n",
       "    'value': 'enough',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 2.04,\n",
       "    'end_s': 2.47,\n",
       "    'value': 'days',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 2.85,\n",
       "    'end_s': 3.08,\n",
       "    'value': 'off',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 3.08,\n",
       "    'end_s': 3.42,\n",
       "    'value': 'in',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 3.56,\n",
       "    'end_s': 3.74,\n",
       "    'value': 'between,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 3.74,\n",
       "    'end_s': 3.8,\n",
       "    'value': 'uh,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 3.8,\n",
       "    'end_s': 4.26,\n",
       "    'value': 'and',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 4.26,\n",
       "    'end_s': 4.35,\n",
       "    'value': \"he's\",\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 4.82,\n",
       "    'end_s': 5.27,\n",
       "    'value': 'also',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'type': 'tag', 'value': '--'},\n",
       "   {'start_s': 5.72,\n",
       "    'end_s': 5.83,\n",
       "    'value': 'He',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 5.83,\n",
       "    'end_s': 5.98,\n",
       "    'value': 'does',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 5.98,\n",
       "    'end_s': 6.22,\n",
       "    'value': 'real',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 6.22,\n",
       "    'end_s': 6.53,\n",
       "    'value': 'well',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 6.53,\n",
       "    'end_s': 6.73,\n",
       "    'value': 'at',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 6.73,\n",
       "    'end_s': 7.35,\n",
       "    'value': 'home.',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 7.35,\n",
       "    'end_s': 7.68,\n",
       "    'value': 'So',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 7.81,\n",
       "    'end_s': 8.27,\n",
       "    'value': 'might',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 8.27,\n",
       "    'end_s': 8.44,\n",
       "    'value': 'as',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 8.44,\n",
       "    'end_s': 8.8,\n",
       "    'value': 'well',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 8.8,\n",
       "    'end_s': 8.96,\n",
       "    'value': 'utilize',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'value': 'that',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0',\n",
       "    'start_s': 8.96,\n",
       "    'end_s': 9.42},\n",
       "   {'start_s': 9.42,\n",
       "    'end_s': 9.77,\n",
       "    'value': 'home',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 9.93,\n",
       "    'end_s': 10.19,\n",
       "    'value': 'field',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 10.19,\n",
       "    'end_s': 10.45,\n",
       "    'value': 'advantage',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 10.45,\n",
       "    'end_s': 10.81,\n",
       "    'value': 'to',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 11.08,\n",
       "    'end_s': 11.3,\n",
       "    'value': 'your',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'},\n",
       "   {'start_s': 11.3,\n",
       "    'end_s': 11.57,\n",
       "    'value': 'favor.',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_0'}]},\n",
       " {'text': \"Scott, something that, uh, Chip is gonna do for all of our listeners if you're already tuning in.\",\n",
       "  'speaker': 'Speaker_1',\n",
       "  'tokens': [{'start_s': 11.57,\n",
       "    'end_s': 11.7,\n",
       "    'value': 'Scott,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 11.7,\n",
       "    'end_s': 12.21,\n",
       "    'value': 'something',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 12.75,\n",
       "    'end_s': 12.87,\n",
       "    'value': 'that,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 12.87,\n",
       "    'end_s': 13.24,\n",
       "    'value': 'uh,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 13.24,\n",
       "    'end_s': 13.4,\n",
       "    'value': 'Chip',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 13.4,\n",
       "    'end_s': 13.84,\n",
       "    'value': 'is',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 13.91,\n",
       "    'end_s': 14.29,\n",
       "    'value': 'gonna',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 14.29,\n",
       "    'end_s': 14.61,\n",
       "    'value': 'do',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 14.61,\n",
       "    'end_s': 14.84,\n",
       "    'value': 'for',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 14.84,\n",
       "    'end_s': 15.13,\n",
       "    'value': 'all',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 15.13,\n",
       "    'end_s': 15.43,\n",
       "    'value': 'of',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 15.43,\n",
       "    'end_s': 15.84,\n",
       "    'value': 'our',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 15.84,\n",
       "    'end_s': 16.3,\n",
       "    'value': 'listeners',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 16.3,\n",
       "    'end_s': 16.43,\n",
       "    'value': 'if',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 16.43,\n",
       "    'end_s': 16.62,\n",
       "    'value': \"you're\",\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 16.62,\n",
       "    'end_s': 17.25,\n",
       "    'value': 'already',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 17.25,\n",
       "    'end_s': 17.6,\n",
       "    'value': 'tuning',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'},\n",
       "   {'start_s': 17.6,\n",
       "    'end_s': 17.97,\n",
       "    'value': 'in.',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1'}]}]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d_old[\"sample\"][-1][\"segments\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bf31de2c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "3366cbb4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "with open(\"/mnt/data-ssd-1/data/southern-comfort/output/artifacts/web-sample-data/sample_manifest_web.json\") as f:\n",
    "    d = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "caf55416",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['text', 'speaker'])"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[\"sample\"][-1][\"segments\"][0].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "903a7d23",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'text': \"Nathan on his normal schedule. He's still got enough days off in between, uh, and he's also -- He does real well at home. So might as well utilize that home field advantage to your favor.\",\n",
       "  'speaker': 'Speaker_0'},\n",
       " {'text': \"Scott, something that, uh, Chip is gonna do for all of our listeners if you're already tuning in.\",\n",
       "  'tokens': [{'value': 'Scott,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 12.75,\n",
       "    'end_s': 13.14},\n",
       "   {'value': 'something',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 13.14,\n",
       "    'end_s': 13.62},\n",
       "   {'value': 'that,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 13.62,\n",
       "    'end_s': 14.0},\n",
       "   {'value': 'uh,',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 14.0,\n",
       "    'end_s': 14.3},\n",
       "   {'value': 'Chip',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 14.36,\n",
       "    'end_s': 14.71},\n",
       "   {'value': 'is',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 14.71,\n",
       "    'end_s': 14.84},\n",
       "   {'value': 'gonna',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 14.84,\n",
       "    'end_s': 15.14},\n",
       "   {'value': 'do',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 15.14,\n",
       "    'end_s': 15.44},\n",
       "   {'value': 'for',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 15.44,\n",
       "    'end_s': 15.63},\n",
       "   {'value': 'all',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 15.63,\n",
       "    'end_s': 15.8},\n",
       "   {'value': 'of',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 15.8,\n",
       "    'end_s': 15.89},\n",
       "   {'value': 'our',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 15.89,\n",
       "    'end_s': 16.02},\n",
       "   {'value': 'listeners',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 16.02,\n",
       "    'end_s': 16.51},\n",
       "   {'value': 'if',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 16.51,\n",
       "    'end_s': 16.68},\n",
       "   {'value': \"you're\",\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 16.68,\n",
       "    'end_s': 16.8},\n",
       "   {'value': 'already',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 16.8,\n",
       "    'end_s': 17.2},\n",
       "   {'value': 'tuning',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 17.2,\n",
       "    'end_s': 17.61},\n",
       "   {'value': 'in.',\n",
       "    'type': 'text',\n",
       "    'speaker_id': 'Speaker_1',\n",
       "    'start_s': 17.61,\n",
       "    'end_s': 17.98}],\n",
       "  'speaker': 'Speaker_1'}]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[\"sample\"][-1][\"segments\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8dbe76b4",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "77f73b2c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "dcd6c7c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "with open(\"tmp.jsonl\") as f:\n",
    "    d = [json.loads(l) for l in f.read().split(\"\\n\") if len(l.strip()) > 0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "335eb79b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"Nathan on his normal schedule. He's still got enough days off in between, uh, and he's also -- He does real well at home. So might as well utilize that home field advantage to your favor. Scott, something that, uh, Chip is gonna do for all of our listeners if you're already tuning in.\""
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[-1][\"transcript\"][\"text\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "dee9060d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'value': 'scott',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 0.04,\n",
       "  'end_s': 0.28},\n",
       " {'value': 'something',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 0.28,\n",
       "  'end_s': 0.53},\n",
       " {'value': 'that',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 0.53,\n",
       "  'end_s': 0.74},\n",
       " {'value': 'uh',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 0.74,\n",
       "  'end_s': 2.48},\n",
       " {'value': 'chip',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 2.85,\n",
       "  'end_s': 2.99},\n",
       " {'value': 'is',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 2.99,\n",
       "  'end_s': 3.1},\n",
       " {'value': 'gonna',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 3.1,\n",
       "  'end_s': 3.4},\n",
       " {'value': 'do',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 3.57,\n",
       "  'end_s': 3.75},\n",
       " {'value': 'for',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 3.75,\n",
       "  'end_s': 3.97},\n",
       " {'value': 'all',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 3.97,\n",
       "  'end_s': 4.06},\n",
       " {'value': 'of',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 4.06,\n",
       "  'end_s': 4.35},\n",
       " {'value': 'our',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 4.82,\n",
       "  'end_s': 5.32},\n",
       " {'value': 'listeners',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 5.71,\n",
       "  'end_s': 6.29},\n",
       " {'value': 'if',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 6.29,\n",
       "  'end_s': 6.57},\n",
       " {'value': \"you're\",\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 6.57,\n",
       "  'end_s': 6.92},\n",
       " {'value': 'already',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 6.92,\n",
       "  'end_s': 7.69},\n",
       " {'value': 'tuning',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 7.81,\n",
       "  'end_s': 8.69},\n",
       " {'value': 'in',\n",
       "  'type': 'text',\n",
       "  'speaker_id': 'Speaker_0',\n",
       "  'start_s': 8.69,\n",
       "  'end_s': 10.83}]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[-1][\"transcript\"][\"tokens_normalized\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "05e9311d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "875dbbe6",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a7bb8d9c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "47d4d21c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "866f2108",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aeaaef92",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "80dcc6ca",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09565519",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
