Spaces:
Sleeping
Sleeping
Commit
Β·
4db92d6
1
Parent(s):
51595ab
Edit Folder
Browse files- classifier/__init__.py +1 -0
- classifier/classifier.py +70 -0
- classifier/experiment.ipynb +381 -0
- {assets β data}/subs/How I Met Your Mother - 01x01 - Pilot.1080p x265 Joy.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x02 - Purple giraffe.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x03 - The sweet taste of liberty.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x04 - Return of the shirt.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x05 - Okay awesome.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x06 - The slutty pumpkin.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x07 - Matchmaker.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x08 - The duel.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x09 - Belly full of turkey.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x10 - The pineapple incident.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x11 - The limo.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x12 - The wedding.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x13 - Drum roll, please.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x14 - Zip, zip, zip.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x15 - Game night.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x16 - Cupcake.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x17 - Life among the gorillas.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x18 - Nothing good happens after 2 AM.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x19 - Mary the paralegal.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x20 - Best prom ever.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x21 - Milk.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/subs/How I Met Your Mother - 01x22 - Come on.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt +0 -0
- {assets β data}/trans/himym_full_transcripts.csv +0 -0
classifier/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .classifier import ThemeClassifier
|
classifier/classifier.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import pathlib
|
4 |
+
import nltk
|
5 |
+
import torch
|
6 |
+
import numpy as np
|
7 |
+
import pandas as pd
|
8 |
+
from transformers import pipeline
|
9 |
+
from nltk.tokenize import sent_tokenize
|
10 |
+
|
11 |
+
folder_name = pathlib.Path(__file__).parent.resolve()
|
12 |
+
sys.path.append(os.path.join(folder_name, "../"))
|
13 |
+
from utils import load_subs
|
14 |
+
|
15 |
+
nltk.download("punkt")
|
16 |
+
nltk.download("punkt_tab")
|
17 |
+
|
18 |
+
class ThemeClassifier:
|
19 |
+
def __init__(self, theme_list):
|
20 |
+
self.model = "facebook/bart-large-mnli"
|
21 |
+
self.device = 0 if torch.cuda.is_available() else "cpu"
|
22 |
+
self.theme_list = theme_list
|
23 |
+
self.theme_classifier = self.load_model(self.device)
|
24 |
+
|
25 |
+
def load_model(self, device):
|
26 |
+
clf = pipeline("zero-shot-classification",
|
27 |
+
model=self.model,
|
28 |
+
device=device)
|
29 |
+
|
30 |
+
return clf
|
31 |
+
|
32 |
+
def get_theme_inference(self, script):
|
33 |
+
|
34 |
+
script_sentences = sent_tokenize(script)
|
35 |
+
sentence_batch_size = 20
|
36 |
+
script_batches = []
|
37 |
+
for index in range(0, len(script_sentences), sentence_batch_size):
|
38 |
+
script_batches.append("".join(script_sentences[index:index + sentence_batch_size]))
|
39 |
+
|
40 |
+
theme_output = self.theme_classifier(
|
41 |
+
script_batches,
|
42 |
+
self.theme_list,
|
43 |
+
multi_label=True
|
44 |
+
)
|
45 |
+
|
46 |
+
themes = {}
|
47 |
+
for output in theme_output:
|
48 |
+
for label, score in zip(output["labels"], output["scores"]):
|
49 |
+
if label not in themes:
|
50 |
+
themes[label] = []
|
51 |
+
themes[label].append(score)
|
52 |
+
|
53 |
+
themes = {key:np.mean(np.array(value)) for key, value in themes.items()}
|
54 |
+
return themes
|
55 |
+
|
56 |
+
def get_themes(self, path, save_path=None):
|
57 |
+
|
58 |
+
# Load dataset
|
59 |
+
df = load_subs(path)
|
60 |
+
|
61 |
+
# Run Inference
|
62 |
+
op = df["script"].apply(self.get_theme_inference)
|
63 |
+
|
64 |
+
theme_df = pd.DataFrame(op.tolist())
|
65 |
+
df[theme_df.columns] = theme_df
|
66 |
+
|
67 |
+
# Save Output
|
68 |
+
if save_path:
|
69 |
+
df.to_csv(save_path, index=False)
|
70 |
+
|
classifier/experiment.ipynb
ADDED
@@ -0,0 +1,381 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import nltk\n",
|
10 |
+
"import torch\n",
|
11 |
+
"import pandas as pd\n",
|
12 |
+
"import numpy as np\n",
|
13 |
+
"from glob import glob\n",
|
14 |
+
"from nltk import sent_tokenize\n",
|
15 |
+
"from transformers import pipeline"
|
16 |
+
]
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"cell_type": "code",
|
20 |
+
"execution_count": null,
|
21 |
+
"metadata": {},
|
22 |
+
"outputs": [],
|
23 |
+
"source": [
|
24 |
+
"nltk.download('punkt')\n",
|
25 |
+
"nltk.download('stopwords')"
|
26 |
+
]
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"cell_type": "code",
|
30 |
+
"execution_count": null,
|
31 |
+
"metadata": {},
|
32 |
+
"outputs": [],
|
33 |
+
"source": [
|
34 |
+
"device = 0 if torch.cuda.is_available() else \"cpu\""
|
35 |
+
]
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"cell_type": "markdown",
|
39 |
+
"metadata": {},
|
40 |
+
"source": [
|
41 |
+
"__Load Model__"
|
42 |
+
]
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"cell_type": "code",
|
46 |
+
"execution_count": null,
|
47 |
+
"metadata": {},
|
48 |
+
"outputs": [],
|
49 |
+
"source": [
|
50 |
+
"model = \"facebook/bart-large-mnli\"\n",
|
51 |
+
"clf = pipeline(\"zero-shot-classification\", \n",
|
52 |
+
" model=model, \n",
|
53 |
+
" device=device)"
|
54 |
+
]
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"cell_type": "code",
|
58 |
+
"execution_count": null,
|
59 |
+
"metadata": {},
|
60 |
+
"outputs": [],
|
61 |
+
"source": [
|
62 |
+
"test = \"I like your phone, does it even work?\"\n",
|
63 |
+
"classes = [\"Love\", \"Appreciation\", \"Sarcasm\", \"Anger\", \"Hunger\", \"Dialogue\"]"
|
64 |
+
]
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"cell_type": "code",
|
68 |
+
"execution_count": null,
|
69 |
+
"metadata": {},
|
70 |
+
"outputs": [],
|
71 |
+
"source": [
|
72 |
+
"clf(test, classes, multi_label=True)"
|
73 |
+
]
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"cell_type": "markdown",
|
77 |
+
"metadata": {},
|
78 |
+
"source": [
|
79 |
+
"__Load Dataset__"
|
80 |
+
]
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"cell_type": "code",
|
84 |
+
"execution_count": null,
|
85 |
+
"metadata": {},
|
86 |
+
"outputs": [],
|
87 |
+
"source": [
|
88 |
+
"subs = glob(\"../data/subs/*.srt\")\n",
|
89 |
+
"subs[:5]"
|
90 |
+
]
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"cell_type": "code",
|
94 |
+
"execution_count": null,
|
95 |
+
"metadata": {},
|
96 |
+
"outputs": [],
|
97 |
+
"source": [
|
98 |
+
"# Understanding Data.\n",
|
99 |
+
"with open(subs[0], \"r\", encoding=\"utf-8\") as f:\n",
|
100 |
+
" con = f.read()\n",
|
101 |
+
" print(con[:150])"
|
102 |
+
]
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"cell_type": "code",
|
106 |
+
"execution_count": null,
|
107 |
+
"metadata": {},
|
108 |
+
"outputs": [],
|
109 |
+
"source": [
|
110 |
+
"with open(subs[0], \"r\", encoding=\"utf-8\") as f:\n",
|
111 |
+
" lines = f.readlines()\n",
|
112 |
+
" cnt = 0\n",
|
113 |
+
" con = []\n",
|
114 |
+
" for line in lines:\n",
|
115 |
+
" line = line.strip()\n",
|
116 |
+
" if line.isnumeric() or \"-->\" in line:\n",
|
117 |
+
" cnt += 1\n",
|
118 |
+
" else:\n",
|
119 |
+
" con.append(line)\n",
|
120 |
+
"\n",
|
121 |
+
"print(f\"Ignored {cnt} lines out of {len(lines)}. Total lines {len(con)} now.\")"
|
122 |
+
]
|
123 |
+
},
|
124 |
+
{
|
125 |
+
"cell_type": "code",
|
126 |
+
"execution_count": null,
|
127 |
+
"metadata": {},
|
128 |
+
"outputs": [],
|
129 |
+
"source": [
|
130 |
+
"# Episode\n",
|
131 |
+
"print(subs[0])\n",
|
132 |
+
"subs[0].split(\"-\")[1].strip()[-1]"
|
133 |
+
]
|
134 |
+
},
|
135 |
+
{
|
136 |
+
"cell_type": "code",
|
137 |
+
"execution_count": null,
|
138 |
+
"metadata": {},
|
139 |
+
"outputs": [],
|
140 |
+
"source": [
|
141 |
+
"def load_subs():\n",
|
142 |
+
" subs = glob(\"../data/subs/*.srt\")\n",
|
143 |
+
" episodes = []\n",
|
144 |
+
" scripts = []\n",
|
145 |
+
"\n",
|
146 |
+
" for sub in subs:\n",
|
147 |
+
" with open(sub, \"r\", encoding=\"utf-8\") as f:\n",
|
148 |
+
" lines = f.readlines()\n",
|
149 |
+
" cnt = 0\n",
|
150 |
+
" con = []\n",
|
151 |
+
" for line in lines:\n",
|
152 |
+
" line = line.strip()\n",
|
153 |
+
" if line.isnumeric() or \"-->\" in line:\n",
|
154 |
+
" cnt += 1\n",
|
155 |
+
" else:\n",
|
156 |
+
" con.append(line)\n",
|
157 |
+
" \n",
|
158 |
+
" script = \" \".join(con)\n",
|
159 |
+
" epno = int(sub.split(\"-\")[1].strip()[-1])\n",
|
160 |
+
" episodes.append(epno)\n",
|
161 |
+
" scripts.append(script)\n",
|
162 |
+
"\n",
|
163 |
+
" df = pd.DataFrame({\"episode\": episodes, \"script\": scripts})\n",
|
164 |
+
" return df"
|
165 |
+
]
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"cell_type": "code",
|
169 |
+
"execution_count": null,
|
170 |
+
"metadata": {},
|
171 |
+
"outputs": [],
|
172 |
+
"source": [
|
173 |
+
"df = load_subs()"
|
174 |
+
]
|
175 |
+
},
|
176 |
+
{
|
177 |
+
"cell_type": "code",
|
178 |
+
"execution_count": null,
|
179 |
+
"metadata": {},
|
180 |
+
"outputs": [],
|
181 |
+
"source": [
|
182 |
+
"df.head()"
|
183 |
+
]
|
184 |
+
},
|
185 |
+
{
|
186 |
+
"cell_type": "markdown",
|
187 |
+
"metadata": {},
|
188 |
+
"source": [
|
189 |
+
"__Model Testing__"
|
190 |
+
]
|
191 |
+
},
|
192 |
+
{
|
193 |
+
"cell_type": "code",
|
194 |
+
"execution_count": null,
|
195 |
+
"metadata": {},
|
196 |
+
"outputs": [],
|
197 |
+
"source": [
|
198 |
+
"script = df.iloc[0][\"script\"]\n",
|
199 |
+
"script"
|
200 |
+
]
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"cell_type": "code",
|
204 |
+
"execution_count": null,
|
205 |
+
"metadata": {},
|
206 |
+
"outputs": [],
|
207 |
+
"source": [
|
208 |
+
"script_sentences = sent_tokenize(script)\n",
|
209 |
+
"script_sentences[:3]"
|
210 |
+
]
|
211 |
+
},
|
212 |
+
{
|
213 |
+
"cell_type": "code",
|
214 |
+
"execution_count": null,
|
215 |
+
"metadata": {},
|
216 |
+
"outputs": [],
|
217 |
+
"source": [
|
218 |
+
"# Batch sentences\n",
|
219 |
+
"sentence_batch_size = 20\n",
|
220 |
+
"script_batches = []\n",
|
221 |
+
"\n",
|
222 |
+
"for index in range(0, len(script_sentences), sentence_batch_size):\n",
|
223 |
+
" script_batches.append(\"\".join(script_sentences[index:index + sentence_batch_size]))"
|
224 |
+
]
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"cell_type": "code",
|
228 |
+
"execution_count": null,
|
229 |
+
"metadata": {},
|
230 |
+
"outputs": [],
|
231 |
+
"source": [
|
232 |
+
"len(script_batches)"
|
233 |
+
]
|
234 |
+
},
|
235 |
+
{
|
236 |
+
"cell_type": "code",
|
237 |
+
"execution_count": null,
|
238 |
+
"metadata": {},
|
239 |
+
"outputs": [],
|
240 |
+
"source": [
|
241 |
+
"theme_output = clf(\n",
|
242 |
+
" script_batches[:2],\n",
|
243 |
+
" classes,\n",
|
244 |
+
" multi_label=True\n",
|
245 |
+
")\n",
|
246 |
+
"\n",
|
247 |
+
"theme_output"
|
248 |
+
]
|
249 |
+
},
|
250 |
+
{
|
251 |
+
"cell_type": "code",
|
252 |
+
"execution_count": null,
|
253 |
+
"metadata": {},
|
254 |
+
"outputs": [],
|
255 |
+
"source": [
|
256 |
+
"themes = {}\n",
|
257 |
+
"for output in theme_output:\n",
|
258 |
+
" for label, score in zip(output[\"labels\"], output[\"scores\"]):\n",
|
259 |
+
" if label not in themes:\n",
|
260 |
+
" themes[label] = []\n",
|
261 |
+
" themes[label].append(score)"
|
262 |
+
]
|
263 |
+
},
|
264 |
+
{
|
265 |
+
"cell_type": "code",
|
266 |
+
"execution_count": null,
|
267 |
+
"metadata": {},
|
268 |
+
"outputs": [],
|
269 |
+
"source": [
|
270 |
+
"themes"
|
271 |
+
]
|
272 |
+
},
|
273 |
+
{
|
274 |
+
"cell_type": "code",
|
275 |
+
"execution_count": null,
|
276 |
+
"metadata": {},
|
277 |
+
"outputs": [],
|
278 |
+
"source": [
|
279 |
+
"def get_theme_inference(script):\n",
|
280 |
+
"\n",
|
281 |
+
" classes = [\"Sarcasm\", \"Happy\", \"Friendship\", \"Vulgar\", \"Anger\", \"Dialogue\", \"Sad\", \"Love\", \"Narration\"]\n",
|
282 |
+
" script_sentences = sent_tokenize(script)\n",
|
283 |
+
" sentence_batch_size = 20\n",
|
284 |
+
" script_batches = []\n",
|
285 |
+
" for index in range(0, len(script_sentences), sentence_batch_size):\n",
|
286 |
+
" script_batches.append(\"\".join(script_sentences[index:index + sentence_batch_size]))\n",
|
287 |
+
"\n",
|
288 |
+
" theme_output = clf(\n",
|
289 |
+
" script_batches,\n",
|
290 |
+
" classes,\n",
|
291 |
+
" multi_label=True\n",
|
292 |
+
" )\n",
|
293 |
+
"\n",
|
294 |
+
" themes = {}\n",
|
295 |
+
" for output in theme_output:\n",
|
296 |
+
" for label, score in zip(output[\"labels\"], output[\"scores\"]):\n",
|
297 |
+
" if label not in themes:\n",
|
298 |
+
" themes[label] = []\n",
|
299 |
+
" themes[label].append(score)\n",
|
300 |
+
" \n",
|
301 |
+
" themes = {key:np.mean(np.array(value)) for key, value in themes.items()}\n",
|
302 |
+
" return themes"
|
303 |
+
]
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"cell_type": "code",
|
307 |
+
"execution_count": null,
|
308 |
+
"metadata": {},
|
309 |
+
"outputs": [],
|
310 |
+
"source": [
|
311 |
+
"opdf = get_theme_inference(script[:500])"
|
312 |
+
]
|
313 |
+
},
|
314 |
+
{
|
315 |
+
"cell_type": "code",
|
316 |
+
"execution_count": null,
|
317 |
+
"metadata": {},
|
318 |
+
"outputs": [],
|
319 |
+
"source": [
|
320 |
+
"opdf = pd.Series(opdf)\n",
|
321 |
+
"opdf"
|
322 |
+
]
|
323 |
+
},
|
324 |
+
{
|
325 |
+
"cell_type": "code",
|
326 |
+
"execution_count": null,
|
327 |
+
"metadata": {},
|
328 |
+
"outputs": [],
|
329 |
+
"source": [
|
330 |
+
"newdf = df.head(1)\n",
|
331 |
+
"newdf[opdf.index] = opdf"
|
332 |
+
]
|
333 |
+
},
|
334 |
+
{
|
335 |
+
"cell_type": "code",
|
336 |
+
"execution_count": null,
|
337 |
+
"metadata": {},
|
338 |
+
"outputs": [],
|
339 |
+
"source": [
|
340 |
+
"newdf"
|
341 |
+
]
|
342 |
+
},
|
343 |
+
{
|
344 |
+
"cell_type": "code",
|
345 |
+
"execution_count": null,
|
346 |
+
"metadata": {},
|
347 |
+
"outputs": [],
|
348 |
+
"source": [
|
349 |
+
"df.head()"
|
350 |
+
]
|
351 |
+
},
|
352 |
+
{
|
353 |
+
"cell_type": "code",
|
354 |
+
"execution_count": null,
|
355 |
+
"metadata": {},
|
356 |
+
"outputs": [],
|
357 |
+
"source": []
|
358 |
+
}
|
359 |
+
],
|
360 |
+
"metadata": {
|
361 |
+
"kernelspec": {
|
362 |
+
"display_name": "venv",
|
363 |
+
"language": "python",
|
364 |
+
"name": "python3"
|
365 |
+
},
|
366 |
+
"language_info": {
|
367 |
+
"codemirror_mode": {
|
368 |
+
"name": "ipython",
|
369 |
+
"version": 3
|
370 |
+
},
|
371 |
+
"file_extension": ".py",
|
372 |
+
"mimetype": "text/x-python",
|
373 |
+
"name": "python",
|
374 |
+
"nbconvert_exporter": "python",
|
375 |
+
"pygments_lexer": "ipython3",
|
376 |
+
"version": "3.11.5"
|
377 |
+
}
|
378 |
+
},
|
379 |
+
"nbformat": 4,
|
380 |
+
"nbformat_minor": 2
|
381 |
+
}
|
{assets β data}/subs/How I Met Your Mother - 01x01 - Pilot.1080p x265 Joy.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x02 - Purple giraffe.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x03 - The sweet taste of liberty.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x04 - Return of the shirt.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x05 - Okay awesome.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x06 - The slutty pumpkin.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x07 - Matchmaker.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x08 - The duel.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x09 - Belly full of turkey.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x10 - The pineapple incident.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x11 - The limo.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x12 - The wedding.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x13 - Drum roll, please.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x14 - Zip, zip, zip.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x15 - Game night.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x16 - Cupcake.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x17 - Life among the gorillas.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x18 - Nothing good happens after 2 AM.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x19 - Mary the paralegal.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x20 - Best prom ever.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x21 - Milk.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/subs/How I Met Your Mother - 01x22 - Come on.720.HDTV.CORTEXiPHAN.English.C.updated.Addic7ed.com.srt
RENAMED
File without changes
|
{assets β data}/trans/himym_full_transcripts.csv
RENAMED
File without changes
|