Format: application/octet-stream
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "id": "e424ac3f",
7 "metadata": {},
8 "outputs": [],
9 "source": [
10 "import pandas as pd\n",
11 "import collections"
12 ]
13 },
14 {
15 "cell_type": "code",
16 "execution_count": 2,
17 "id": "99457d31",
18 "metadata": {},
19 "outputs": [],
20 "source": [
21 "plots=pd.read_csv('tagsText.tsv', sep='\\t')\n",
22 "plots1=pd.read_csv('tagsText1.tsv', sep='\\t')\n",
23 "plots=plots.append(plots1, ignore_index=True)\n",
24 "del plots1"
25 ]
26 },
27 {
28 "cell_type": "code",
29 "execution_count": 3,
30 "id": "4a8f3e76",
31 "metadata": {},
32 "outputs": [],
33 "source": [
34 "plotTags=pd.read_csv('plot_tags.tsv', sep='\\t')\n",
35 "plotTags1=pd.read_csv('plot_tags1.tsv', sep='\\t')\n",
36 "plotTags=plotTags.append(plotTags1, ignore_index=True)\n",
37 "del plotTags1"
38 ]
39 },
40 {
41 "cell_type": "code",
42 "execution_count": null,
43 "id": "18ec90b2",
44 "metadata": {},
45 "outputs": [],
46 "source": []
47 },
48 {
49 "cell_type": "code",
50 "execution_count": 4,
51 "id": "33a12c29",
52 "metadata": {},
53 "outputs": [
54 {
55 "data": {
56 "text/html": [
57 "<div>\n",
58 "<style scoped>\n",
59 " .dataframe tbody tr th:only-of-type {\n",
60 " vertical-align: middle;\n",
61 " }\n",
62 "\n",
63 " .dataframe tbody tr th {\n",
64 " vertical-align: top;\n",
65 " }\n",
66 "\n",
67 " .dataframe thead th {\n",
68 " text-align: right;\n",
69 " }\n",
70 "</style>\n",
71 "<table border=\"1\" class=\"dataframe\">\n",
72 " <thead>\n",
73 " <tr style=\"text-align: right;\">\n",
74 " <th></th>\n",
75 " <th>titleId</th>\n",
76 " <th>title</th>\n",
77 " <th>genres</th>\n",
78 " <th>TagsText</th>\n",
79 " </tr>\n",
80 " </thead>\n",
81 " <tbody>\n",
82 " <tr>\n",
83 " <th>0</th>\n",
84 " <td>tt0111161</td>\n",
85 " <td>The Shawshank Redemption</td>\n",
86 " <td>Drama</td>\n",
87 " <td>Drama The Shawshank Redemption wrongful impris...</td>\n",
88 " </tr>\n",
89 " <tr>\n",
90 " <th>1</th>\n",
91 " <td>tt0468569</td>\n",
92 " <td>The Dark Knight</td>\n",
93 " <td>Action Crime Drama</td>\n",
94 " <td>Action Crime Drama The Dark Knight dc comics j...</td>\n",
95 " </tr>\n",
96 " <tr>\n",
97 " <th>2</th>\n",
98 " <td>tt1375666</td>\n",
99 " <td>Inception</td>\n",
100 " <td>Action Adventure Sci-Fi</td>\n",
101 " <td>Action Adventure Sci-Fi Inception dream ambigu...</td>\n",
102 " </tr>\n",
103 " <tr>\n",
104 " <th>3</th>\n",
105 " <td>tt0137523</td>\n",
106 " <td>Fight Club</td>\n",
107 " <td>Drama</td>\n",
108 " <td>Drama Fight Club fighting surprise ending anti...</td>\n",
109 " </tr>\n",
110 " <tr>\n",
111 " <th>4</th>\n",
112 " <td>tt0110912</td>\n",
113 " <td>Pulp Fiction</td>\n",
114 " <td>Crime Drama</td>\n",
115 " <td>Crime Drama Pulp Fiction nonlinear timeline ov...</td>\n",
116 " </tr>\n",
117 " <tr>\n",
118 " <th>...</th>\n",
119 " <td>...</td>\n",
120 " <td>...</td>\n",
121 " <td>...</td>\n",
122 " <td>...</td>\n",
123 " </tr>\n",
124 " <tr>\n",
125 " <th>3995</th>\n",
126 " <td>tt0020530</td>\n",
127 " <td>Un chien andalou</td>\n",
128 " <td>Fantasy Horror Short</td>\n",
129 " <td>Fantasy Horror Short Un chien andalou surreali...</td>\n",
130 " </tr>\n",
131 " <tr>\n",
132 " <th>3996</th>\n",
133 " <td>tt0117918</td>\n",
134 " <td>Tin Cup</td>\n",
135 " <td>Comedy Drama Romance</td>\n",
136 " <td>Comedy Drama Romance Tin Cup golf nickname lov...</td>\n",
137 " </tr>\n",
138 " <tr>\n",
139 " <th>3997</th>\n",
140 " <td>tt0123964</td>\n",
141 " <td>Life</td>\n",
142 " <td>Comedy Crime Drama</td>\n",
143 " <td>Comedy Crime Drama Life baseball year 1932 wro...</td>\n",
144 " </tr>\n",
145 " <tr>\n",
146 " <th>3998</th>\n",
147 " <td>tt0110950</td>\n",
148 " <td>Reality Bites</td>\n",
149 " <td>Comedy Drama Romance</td>\n",
150 " <td>Comedy Drama Romance Reality Bites generation ...</td>\n",
151 " </tr>\n",
152 " <tr>\n",
153 " <th>3999</th>\n",
154 " <td>tt1017451</td>\n",
155 " <td>The Runaways</td>\n",
156 " <td>Biography Drama Music</td>\n",
157 " <td>Biography Drama Music The Runaways f rated rev...</td>\n",
158 " </tr>\n",
159 " </tbody>\n",
160 "</table>\n",
161 "<p>4000 rows × 4 columns</p>\n",
162 "</div>"
163 ],
164 "text/plain": [
165 " titleId title genres \\\n",
166 "0 tt0111161 The Shawshank Redemption Drama \n",
167 "1 tt0468569 The Dark Knight Action Crime Drama \n",
168 "2 tt1375666 Inception Action Adventure Sci-Fi \n",
169 "3 tt0137523 Fight Club Drama \n",
170 "4 tt0110912 Pulp Fiction Crime Drama \n",
171 "... ... ... ... \n",
172 "3995 tt0020530 Un chien andalou Fantasy Horror Short \n",
173 "3996 tt0117918 Tin Cup Comedy Drama Romance \n",
174 "3997 tt0123964 Life Comedy Crime Drama \n",
175 "3998 tt0110950 Reality Bites Comedy Drama Romance \n",
176 "3999 tt1017451 The Runaways Biography Drama Music \n",
177 "\n",
178 " TagsText \n",
179 "0 Drama The Shawshank Redemption wrongful impris... \n",
180 "1 Action Crime Drama The Dark Knight dc comics j... \n",
181 "2 Action Adventure Sci-Fi Inception dream ambigu... \n",
182 "3 Drama Fight Club fighting surprise ending anti... \n",
183 "4 Crime Drama Pulp Fiction nonlinear timeline ov... \n",
184 "... ... \n",
185 "3995 Fantasy Horror Short Un chien andalou surreali... \n",
186 "3996 Comedy Drama Romance Tin Cup golf nickname lov... \n",
187 "3997 Comedy Crime Drama Life baseball year 1932 wro... \n",
188 "3998 Comedy Drama Romance Reality Bites generation ... \n",
189 "3999 Biography Drama Music The Runaways f rated rev... \n",
190 "\n",
191 "[4000 rows x 4 columns]"
192 ]
193 },
194 "execution_count": 4,
195 "metadata": {},
196 "output_type": "execute_result"
197 }
198 ],
199 "source": [
200 "movies= pd.read_csv('Final Dataa.tsv', sep= '\\t')\n",
201 "movies=movies[['titleId', 'title','genres']].merge(plots, left_index=True, right_index=True)\n",
202 "movies.rename(columns={'0':'TagsText'},inplace=True)\n",
203 "\n",
204 "movies.genres=movies.genres.str.replace(',', ' ')\n",
205 "movies.TagsText= movies.genres+' '+movies.title+' '+movies.TagsText\n",
206 "movies"
207 ]
208 },
209 {
210 "cell_type": "code",
211 "execution_count": null,
212 "id": "e04517c8",
213 "metadata": {},
214 "outputs": [],
215 "source": []
216 },
217 {
218 "cell_type": "code",
219 "execution_count": null,
220 "id": "de9c8e0f",
221 "metadata": {},
222 "outputs": [],
223 "source": []
224 },
225 {
226 "cell_type": "code",
227 "execution_count": null,
228 "id": "edac3b3b",
229 "metadata": {},
230 "outputs": [],
231 "source": []
232 },
233 {
234 "cell_type": "code",
235 "execution_count": 5,
236 "id": "01b593b5",
237 "metadata": {},
238 "outputs": [
239 {
240 "name": "stderr",
241 "output_type": "stream",
242 "text": [
243 "C:\\Users\\PC\\anaconda3\\lib\\site-packages\\gensim\\similarities\\__init__.py:15: UserWarning: The gensim.similarities.levenshtein submodule is disabled, because the optional Levenshtein package <https://pypi.org/project/python-Levenshtein/> is unavailable. Install Levenhstein (e.g. `pip install python-Levenshtein`) to suppress this warning.\n",
244 " warnings.warn(msg)\n"
245 ]
246 }
247 ],
248 "source": [
249 "from nltk.tokenize import wordpunct_tokenize\n",
250 "from nltk.tokenize import word_tokenize\n",
251 "import spacy\n",
252 "nlp= spacy.load('en_core_web_sm')\n",
253 "from nltk.corpus import stopwords\n",
254 "from gensim.utils import simple_preprocess\n",
255 "stopwords= stopwords.words('english')\n",
256 "stopwords.extend(['nude','nudity','male','female','men','women','boy','girl','age','frontal','pubic','woman','man','hair',\\\n",
257 " 'underwear', 'pant','sex',\"'s\", 'aaaxxxyyy','sexual'])"
258 ]
259 },
260 {
261 "cell_type": "code",
262 "execution_count": null,
263 "id": "b02317f1",
264 "metadata": {},
265 "outputs": [],
266 "source": []
267 },
268 {
269 "cell_type": "code",
270 "execution_count": 6,
271 "id": "ac78a85e",
272 "metadata": {},
273 "outputs": [],
274 "source": [
275 "words=[]\n",
276 "def preprocess(text):\n",
277 " text=' '.join(simple_preprocess(text, deacc= True))\n",
278 " doc= nlp(text)\n",
279 " text=[]\n",
280 " for token in doc:\n",
281 " lemma= token.lemma_\n",
282 " if lemma not in stopwords:\n",
283 " text.append(lemma)\n",
284 " if lemma not in words and len(lemma)> 3:\n",
285 " words.append(lemma)\n",
286 " text=' '.join(text)\n",
287 " \n",
288 " return text\n",
289 "\n",
290 "\n",
291 "\n",
292 "movies.TagsText=movies.TagsText.apply(lambda x: preprocess(x))"
293 ]
294 },
295 {
296 "cell_type": "code",
297 "execution_count": null,
298 "id": "239dd339",
299 "metadata": {},
300 "outputs": [],
301 "source": []
302 },
303 {
304 "cell_type": "code",
305 "execution_count": 7,
306 "id": "532dd0fc",
307 "metadata": {},
308 "outputs": [],
309 "source": [
310 "plots=movies.TagsText.to_numpy()\n",
311 "words= list(set(words))"
312 ]
313 },
314 {
315 "cell_type": "code",
316 "execution_count": null,
317 "id": "26011475",
318 "metadata": {},
319 "outputs": [],
320 "source": []
321 },
322 {
323 "cell_type": "code",
324 "execution_count": null,
325 "id": "cb769a05",
326 "metadata": {},
327 "outputs": [],
328 "source": [
329 " "
330 ]
331 },
332 {
333 "cell_type": "code",
334 "execution_count": null,
335 "id": "82466f3e",
336 "metadata": {},
337 "outputs": [],
338 "source": []
339 },
340 {
341 "cell_type": "code",
342 "execution_count": 8,
343 "id": "6147f3d8",
344 "metadata": {},
345 "outputs": [],
346 "source": [
347 "#vector matrix is which word in which plot and how many times"
348 ]
349 },
350 {
351 "cell_type": "code",
352 "execution_count": 9,
353 "id": "2788c62e",
354 "metadata": {},
355 "outputs": [],
356 "source": [
357 "import numpy as np\n",
358 "vector_matrix= pd.DataFrame(np.zeros(( len(movies) , len(words) )), columns=words, index= movies.TagsText)"
359 ]
360 },
361 {
362 "cell_type": "code",
363 "execution_count": null,
364 "id": "93faa48b",
365 "metadata": {},
366 "outputs": [],
367 "source": []
368 },
369 {
370 "cell_type": "code",
371 "execution_count": 10,
372 "id": "2a2be687",
373 "metadata": {},
374 "outputs": [],
375 "source": [
376 "def word_counter(column):\n",
377 " word=column.name\n",
378 " #print(word)\n",
379 " texts= movies.TagsText.to_numpy()\n",
380 " score=[]\n",
381 " for i, text in enumerate(texts):\n",
382 " \n",
383 " c=text.count(word)\n",
384 " if c>2:\n",
385 " score.append(1)\n",
386 " else:\n",
387 " score.append(0)\n",
388 " return score\n",
389 "\n",
390 "\n",
391 "vector_matrix= vector_matrix.apply(lambda x: word_counter(x))\n",
392 "#vector_matrix=vector_matrix[vector_matrix>0]"
393 ]
394 },
395 {
396 "cell_type": "code",
397 "execution_count": null,
398 "id": "32aa8c6d",
399 "metadata": {},
400 "outputs": [],
401 "source": []
402 },
403 {
404 "cell_type": "code",
405 "execution_count": null,
406 "id": "5a7bb779",
407 "metadata": {},
408 "outputs": [],
409 "source": []
410 },
411 {
412 "cell_type": "code",
413 "execution_count": 11,
414 "id": "efa2728b",
415 "metadata": {},
416 "outputs": [],
417 "source": [
418 "def word_freq(x, minimum_freq=3):\n",
419 " #x=x[x>1]\n",
420 " y=x.describe().T\n",
421 " y=y[y['count']> minimum_freq-1].T.dropna(axis=1).columns\n",
422 " return x[y].fillna(0)"
423 ]
424 },
425 {
426 "cell_type": "code",
427 "execution_count": 12,
428 "id": "e34600cf",
429 "metadata": {},
430 "outputs": [],
431 "source": [
432 "vector_matrix=word_freq(vector_matrix)"
433 ]
434 },
435 {
436 "cell_type": "code",
437 "execution_count": 13,
438 "id": "ccce4485",
439 "metadata": {},
440 "outputs": [
441 {
442 "data": {
443 "text/html": [
444 "<div>\n",
445 "<style scoped>\n",
446 " .dataframe tbody tr th:only-of-type {\n",
447 " vertical-align: middle;\n",
448 " }\n",
449 "\n",
450 " .dataframe tbody tr th {\n",
451 " vertical-align: top;\n",
452 " }\n",
453 "\n",
454 " .dataframe thead th {\n",
455 " text-align: right;\n",
456 " }\n",
457 "</style>\n",
458 "<table border=\"1\" class=\"dataframe\">\n",
459 " <thead>\n",
460 " <tr style=\"text-align: right;\">\n",
461 " <th></th>\n",
462 " <th>flockhart</th>\n",
463 " <th>pantomime</th>\n",
464 " <th>mongolian</th>\n",
465 " <th>lindsay</th>\n",
466 " <th>euthanize</th>\n",
467 " <th>nader</th>\n",
468 " <th>deer</th>\n",
469 " <th>unloading</th>\n",
470 " <th>clone</th>\n",
471 " <th>sleeve</th>\n",
472 " <th>...</th>\n",
473 " <th>motivator</th>\n",
474 " <th>cryptoanalyst</th>\n",
475 " <th>plough</th>\n",
476 " <th>solitary</th>\n",
477 " <th>scottsdale</th>\n",
478 " <th>jovi</th>\n",
479 " <th>seashell</th>\n",
480 " <th>electrical</th>\n",
481 " <th>headquarters</th>\n",
482 " <th>victory</th>\n",
483 " </tr>\n",
484 " <tr>\n",
485 " <th>TagsText</th>\n",
486 " <th></th>\n",
487 " <th></th>\n",
488 " <th></th>\n",
489 " <th></th>\n",
490 " <th></th>\n",
491 " <th></th>\n",
492 " <th></th>\n",
493 " <th></th>\n",
494 " <th></th>\n",
495 " <th></th>\n",
496 " <th></th>\n",
497 " <th></th>\n",
498 " <th></th>\n",
499 " <th></th>\n",
500 " <th></th>\n",
501 " <th></th>\n",
502 " <th></th>\n",
503 " <th></th>\n",
504 " <th></th>\n",
505 " <th></th>\n",
506 " <th></th>\n",
507 " </tr>\n",
508 " </thead>\n",
509 " <tbody>\n",
510 " <tr>\n",
511 " <th>drama shawshank redemption wrongful imprisonment base work stephen king prison escape prison voice narration police brutality prison cell search friendship infidelity suicide suicide villain cheat wife harlot wrongful conviction suicide hang life imprisonment unfaithful wife base novella plot twist prison yard reference rita hayworth tunneling freedom prison guard wall betrayer pig loose easy imprisonment carve tin box reference fort hancock texas voice letter maggot trial suicide gunshot suicide friend miss prisoner solitary confinement surprise end stand rita hayworth poster prison library first person narration parole board parole hear assault gay rape banker shower room talk bird vinyl record betting watch movie record player biblical quote masterpiece shawshank</th>\n",
512 " <td>0</td>\n",
513 " <td>0</td>\n",
514 " <td>0</td>\n",
515 " <td>0</td>\n",
516 " <td>0</td>\n",
517 " <td>0</td>\n",
518 " <td>0</td>\n",
519 " <td>0</td>\n",
520 " <td>0</td>\n",
521 " <td>0</td>\n",
522 " <td>...</td>\n",
523 " <td>0</td>\n",
524 " <td>0</td>\n",
525 " <td>0</td>\n",
526 " <td>0</td>\n",
527 " <td>0</td>\n",
528 " <td>0</td>\n",
529 " <td>0</td>\n",
530 " <td>0</td>\n",
531 " <td>0</td>\n",
532 " <td>0</td>\n",
533 " </tr>\n",
534 " <tr>\n",
535 " <th>action crime drama dark knight dc comic_strip joker psychopath clown criminal mastermind scarred face superhero moral dilemma clown mask dual identity psychological manipulation base comic book evil clown opening action scene disfigurement batmobile electronic music score second part mob boss star die release organize crime hero evil sequel sequel reboot joker character urban set money love triangle skyscraper mobster human monster race time super villain jujitsu face paint clown face billionaire tragic hero batman character bruce wayne character batman joker neo noir villain chaos presume dead alfred pennyworth character barbara gordon character harvey dent character opening credit electronic music score style orchestral music score title begin title end district attorney coin flip mysterious tragic past stylize violence grenade henchman</th>\n",
536 " <td>0</td>\n",
537 " <td>0</td>\n",
538 " <td>0</td>\n",
539 " <td>0</td>\n",
540 " <td>0</td>\n",
541 " <td>0</td>\n",
542 " <td>0</td>\n",
543 " <td>0</td>\n",
544 " <td>0</td>\n",
545 " <td>0</td>\n",
546 " <td>...</td>\n",
547 " <td>0</td>\n",
548 " <td>0</td>\n",
549 " <td>0</td>\n",
550 " <td>0</td>\n",
551 " <td>0</td>\n",
552 " <td>0</td>\n",
553 " <td>0</td>\n",
554 " <td>0</td>\n",
555 " <td>0</td>\n",
556 " <td>0</td>\n",
557 " </tr>\n",
558 " <tr>\n",
559 " <th>action adventure sci fi inception dream ambiguous end subconscious surprise end mindbender psycho thriller strong character architecture psychological manipulation fall height hero strong lead architect fantasy become reality deception kidnapping write director child suspense marriage suicide memory suicide attempt spin top title speak character title end character repeat someone else dialogue dream sequence dream sequence within dream sequence dream within dream elevator airplane guilt dream within dream within dream bathtub hotel bar train corporate espionage neo noir alter version studio logo nonlinear timeline haunt past van disguise jump height hallway tie chair hostage manipulation ensemble cast death revenge ambiguity produce director night underwater scene brawl sniper building collapse</th>\n",
560 " <td>0</td>\n",
561 " <td>0</td>\n",
562 " <td>0</td>\n",
563 " <td>0</td>\n",
564 " <td>0</td>\n",
565 " <td>0</td>\n",
566 " <td>0</td>\n",
567 " <td>0</td>\n",
568 " <td>0</td>\n",
569 " <td>0</td>\n",
570 " <td>...</td>\n",
571 " <td>0</td>\n",
572 " <td>0</td>\n",
573 " <td>0</td>\n",
574 " <td>0</td>\n",
575 " <td>0</td>\n",
576 " <td>0</td>\n",
577 " <td>0</td>\n",
578 " <td>0</td>\n",
579 " <td>0</td>\n",
580 " <td>0</td>\n",
581 " </tr>\n",
582 " <tr>\n",
583 " <th>drama fight club fight surprise end anti establishment insomnia multiple personality disorder base novel group therapy anti conformity anti capitalism disturb individual ikea black comedy graphic violence self destructiveness suicide attempt consumerism plot twist alter ego homoerotic break fourth wall dissociative identity disorder desire anti social behavior loss control mental instability alienation imaginary friend violence scene masochism cult film anti hero testicular cancer base book sadomasochism philosophy unreliable narrator schizophrenia overhear cult classic self injury famous twist soap fight support group control rage missionary position missionary position listen breast exam sound dream manic pixie dream underground sport breast drunkenness title fight beat pulp attraction</th>\n",
584 " <td>0</td>\n",
585 " <td>0</td>\n",
586 " <td>0</td>\n",
587 " <td>0</td>\n",
588 " <td>0</td>\n",
589 " <td>0</td>\n",
590 " <td>0</td>\n",
591 " <td>0</td>\n",
592 " <td>0</td>\n",
593 " <td>0</td>\n",
594 " <td>...</td>\n",
595 " <td>0</td>\n",
596 " <td>0</td>\n",
597 " <td>0</td>\n",
598 " <td>0</td>\n",
599 " <td>0</td>\n",
600 " <td>0</td>\n",
601 " <td>0</td>\n",
602 " <td>0</td>\n",
603 " <td>0</td>\n",
604 " <td>0</td>\n",
605 " </tr>\n",
606 " <tr>\n",
607 " <th>crime drama pulp fiction nonlinear timeline overdose drug overdose drug use bondage drug deal neo noir rape car accident dance contest black comedy violence rapist shootout drug dealer postmodern gangster restaurant robbery corpse marijuana joint organize crime boxer violence rape anal rape cunnilingus slave oral motel multiple perspective torture bible quote bind gag multiple storyline ensemble cast serial rapist professional killer anthology mini dress pantie blue pantie white pantie katana tie chair ball gag hit car strip club double cross run drug snort murder heroin cult film dark comedy restaurant briefcase imply cunnilingus scantily clothe problem solver</th>\n",
608 " <td>0</td>\n",
609 " <td>0</td>\n",
610 " <td>0</td>\n",
611 " <td>0</td>\n",
612 " <td>0</td>\n",
613 " <td>0</td>\n",
614 " <td>0</td>\n",
615 " <td>0</td>\n",
616 " <td>0</td>\n",
617 " <td>0</td>\n",
618 " <td>...</td>\n",
619 " <td>0</td>\n",
620 " <td>0</td>\n",
621 " <td>0</td>\n",
622 " <td>0</td>\n",
623 " <td>0</td>\n",
624 " <td>0</td>\n",
625 " <td>0</td>\n",
626 " <td>0</td>\n",
627 " <td>0</td>\n",
628 " <td>0</td>\n",
629 " </tr>\n",
630 " <tr>\n",
631 " <th>...</th>\n",
632 " <td>...</td>\n",
633 " <td>...</td>\n",
634 " <td>...</td>\n",
635 " <td>...</td>\n",
636 " <td>...</td>\n",
637 " <td>...</td>\n",
638 " <td>...</td>\n",
639 " <td>...</td>\n",
640 " <td>...</td>\n",
641 " <td>...</td>\n",
642 " <td>...</td>\n",
643 " <td>...</td>\n",
644 " <td>...</td>\n",
645 " <td>...</td>\n",
646 " <td>...</td>\n",
647 " <td>...</td>\n",
648 " <td>...</td>\n",
649 " <td>...</td>\n",
650 " <td>...</td>\n",
651 " <td>...</td>\n",
652 " <td>...</td>\n",
653 " </tr>\n",
654 " <tr>\n",
655 " <th>fantasy horror short un chien andalou surrealism donkey breast fondle eye injury ant piano grand piano bicycle accident full moon experimental film gun nonlinear timeline mutilation avant garde cult film anti clericalism moon oneiric nihilism razor straight razor sever hand priest androgynous character androgynous death box desire unshaved armpit armpit absurdism controversy territory name title animal title midnight movie transvestism murder hit car fondle corpse carcass bicycle armpit</th>\n",
656 " <td>0</td>\n",
657 " <td>0</td>\n",
658 " <td>0</td>\n",
659 " <td>0</td>\n",
660 " <td>0</td>\n",
661 " <td>0</td>\n",
662 " <td>0</td>\n",
663 " <td>0</td>\n",
664 " <td>0</td>\n",
665 " <td>0</td>\n",
666 " <td>...</td>\n",
667 " <td>0</td>\n",
668 " <td>0</td>\n",
669 " <td>0</td>\n",
670 " <td>0</td>\n",
671 " <td>0</td>\n",
672 " <td>0</td>\n",
673 " <td>0</td>\n",
674 " <td>0</td>\n",
675 " <td>0</td>\n",
676 " <td>0</td>\n",
677 " </tr>\n",
678 " <tr>\n",
679 " <th>comedy drama romance tin cup golf nickname love kiss friend rivalry texas psychologist arrogance wager temper golf movie car automobile convertible car cadillac cadillac motor vehicle cadillac convertible japanese car nissan nissan motor vehicle nissan convertible nissan zx motorhome winnebago winnebago indian golf lesson golf tournament golf player golf course golf club golf ball title speak character</th>\n",
680 " <td>0</td>\n",
681 " <td>0</td>\n",
682 " <td>0</td>\n",
683 " <td>0</td>\n",
684 " <td>0</td>\n",
685 " <td>0</td>\n",
686 " <td>0</td>\n",
687 " <td>0</td>\n",
688 " <td>0</td>\n",
689 " <td>0</td>\n",
690 " <td>...</td>\n",
691 " <td>0</td>\n",
692 " <td>0</td>\n",
693 " <td>0</td>\n",
694 " <td>0</td>\n",
695 " <td>0</td>\n",
696 " <td>0</td>\n",
697 " <td>0</td>\n",
698 " <td>0</td>\n",
699 " <td>0</td>\n",
700 " <td>0</td>\n",
701 " </tr>\n",
702 " <tr>\n",
703 " <th>comedy crime drama life baseball year wrongful conviction passage time wrongful imprisonment black comedy flashback sheriff mississippi life imprisonment criminal watch great depression hold gunpoint friendship word profanity prison violence pump action shotgun winchester rifle repeat rifle comic violence violence bare knuckle fighting fistfight prison fight bully bully comeuppance obesity false accusation racist racial injustice prison life prison labor prison guard prison farm prison escape prison cell new york city jail fat escape attempt death affection bootlegging bootlegger bootleg liquor interracial relationship segregation crop duster racism blooper credit poker friendship prison southern african american pie</th>\n",
704 " <td>0</td>\n",
705 " <td>0</td>\n",
706 " <td>0</td>\n",
707 " <td>0</td>\n",
708 " <td>0</td>\n",
709 " <td>0</td>\n",
710 " <td>0</td>\n",
711 " <td>0</td>\n",
712 " <td>0</td>\n",
713 " <td>0</td>\n",
714 " <td>...</td>\n",
715 " <td>0</td>\n",
716 " <td>0</td>\n",
717 " <td>0</td>\n",
718 " <td>0</td>\n",
719 " <td>0</td>\n",
720 " <td>0</td>\n",
721 " <td>0</td>\n",
722 " <td>0</td>\n",
723 " <td>0</td>\n",
724 " <td>0</td>\n",
725 " </tr>\n",
726 " <tr>\n",
727 " <th>comedy drama romance reality bite generation houston texas texas nipple visible clothing vito russo test pass imply car crash smoking marijuana reference bill clinton romantic triangle clothing store roommate aid test television studio morning talk show cue card pilot show slacker rock band argument chicago illinois romantic reconciliation credit card debt fire job love valedictorian directorial debut two word title college fictional reality show college graduation teen movie twenty something track friendship video footage medium hype cult film</th>\n",
728 " <td>0</td>\n",
729 " <td>0</td>\n",
730 " <td>0</td>\n",
731 " <td>0</td>\n",
732 " <td>0</td>\n",
733 " <td>0</td>\n",
734 " <td>0</td>\n",
735 " <td>0</td>\n",
736 " <td>0</td>\n",
737 " <td>0</td>\n",
738 " <td>...</td>\n",
739 " <td>0</td>\n",
740 " <td>0</td>\n",
741 " <td>0</td>\n",
742 " <td>0</td>\n",
743 " <td>0</td>\n",
744 " <td>0</td>\n",
745 " <td>0</td>\n",
746 " <td>0</td>\n",
747 " <td>0</td>\n",
748 " <td>0</td>\n",
749 " </tr>\n",
750 " <tr>\n",
751 " <th>biography drama music runaway rate revisionist history triple rate feminist film cherry bomb high heel crush pill crush pill feminism band rock star guitarist friend drummer vodka tour publicity band japan drug rock band band member rock roll coming reference beatle strong lead strong character teen movie nightclub leather record player masturbation stage performance stage song singing singer rock musician rock group rock concert roadtrip recording reconciliation pill abuse party paint face road music industry musician music group music concert music business money microphone mend friendship listen music leave home guitar player grow</th>\n",
752 " <td>0</td>\n",
753 " <td>0</td>\n",
754 " <td>0</td>\n",
755 " <td>0</td>\n",
756 " <td>0</td>\n",
757 " <td>0</td>\n",
758 " <td>0</td>\n",
759 " <td>0</td>\n",
760 " <td>0</td>\n",
761 " <td>0</td>\n",
762 " <td>...</td>\n",
763 " <td>0</td>\n",
764 " <td>0</td>\n",
765 " <td>0</td>\n",
766 " <td>0</td>\n",
767 " <td>0</td>\n",
768 " <td>0</td>\n",
769 " <td>0</td>\n",
770 " <td>0</td>\n",
771 " <td>0</td>\n",
772 " <td>0</td>\n",
773 " </tr>\n",
774 " </tbody>\n",
775 "</table>\n",
776 "<p>4000 rows × 17825 columns</p>\n",
777 "</div>"
778 ],
779 "text/plain": [
780 " flockhart pantomime \\\n",
781 "TagsText \n",
782 "drama shawshank redemption wrongful imprisonmen... 0 0 \n",
783 "action crime drama dark knight dc comic_strip j... 0 0 \n",
784 "action adventure sci fi inception dream ambiguo... 0 0 \n",
785 "drama fight club fight surprise end anti establ... 0 0 \n",
786 "crime drama pulp fiction nonlinear timeline ove... 0 0 \n",
787 "... ... ... \n",
788 "fantasy horror short un chien andalou surrealis... 0 0 \n",
789 "comedy drama romance tin cup golf nickname love... 0 0 \n",
790 "comedy crime drama life baseball year wrongful ... 0 0 \n",
791 "comedy drama romance reality bite generation ho... 0 0 \n",
792 "biography drama music runaway rate revisionist ... 0 0 \n",
793 "\n",
794 " mongolian lindsay \\\n",
795 "TagsText \n",
796 "drama shawshank redemption wrongful imprisonmen... 0 0 \n",
797 "action crime drama dark knight dc comic_strip j... 0 0 \n",
798 "action adventure sci fi inception dream ambiguo... 0 0 \n",
799 "drama fight club fight surprise end anti establ... 0 0 \n",
800 "crime drama pulp fiction nonlinear timeline ove... 0 0 \n",
801 "... ... ... \n",
802 "fantasy horror short un chien andalou surrealis... 0 0 \n",
803 "comedy drama romance tin cup golf nickname love... 0 0 \n",
804 "comedy crime drama life baseball year wrongful ... 0 0 \n",
805 "comedy drama romance reality bite generation ho... 0 0 \n",
806 "biography drama music runaway rate revisionist ... 0 0 \n",
807 "\n",
808 " euthanize nader deer \\\n",
809 "TagsText \n",
810 "drama shawshank redemption wrongful imprisonmen... 0 0 0 \n",
811 "action crime drama dark knight dc comic_strip j... 0 0 0 \n",
812 "action adventure sci fi inception dream ambiguo... 0 0 0 \n",
813 "drama fight club fight surprise end anti establ... 0 0 0 \n",
814 "crime drama pulp fiction nonlinear timeline ove... 0 0 0 \n",
815 "... ... ... ... \n",
816 "fantasy horror short un chien andalou surrealis... 0 0 0 \n",
817 "comedy drama romance tin cup golf nickname love... 0 0 0 \n",
818 "comedy crime drama life baseball year wrongful ... 0 0 0 \n",
819 "comedy drama romance reality bite generation ho... 0 0 0 \n",
820 "biography drama music runaway rate revisionist ... 0 0 0 \n",
821 "\n",
822 " unloading clone sleeve \\\n",
823 "TagsText \n",
824 "drama shawshank redemption wrongful imprisonmen... 0 0 0 \n",
825 "action crime drama dark knight dc comic_strip j... 0 0 0 \n",
826 "action adventure sci fi inception dream ambiguo... 0 0 0 \n",
827 "drama fight club fight surprise end anti establ... 0 0 0 \n",
828 "crime drama pulp fiction nonlinear timeline ove... 0 0 0 \n",
829 "... ... ... ... \n",
830 "fantasy horror short un chien andalou surrealis... 0 0 0 \n",
831 "comedy drama romance tin cup golf nickname love... 0 0 0 \n",
832 "comedy crime drama life baseball year wrongful ... 0 0 0 \n",
833 "comedy drama romance reality bite generation ho... 0 0 0 \n",
834 "biography drama music runaway rate revisionist ... 0 0 0 \n",
835 "\n",
836 " ... motivator \\\n",
837 "TagsText ... \n",
838 "drama shawshank redemption wrongful imprisonmen... ... 0 \n",
839 "action crime drama dark knight dc comic_strip j... ... 0 \n",
840 "action adventure sci fi inception dream ambiguo... ... 0 \n",
841 "drama fight club fight surprise end anti establ... ... 0 \n",
842 "crime drama pulp fiction nonlinear timeline ove... ... 0 \n",
843 "... ... ... \n",
844 "fantasy horror short un chien andalou surrealis... ... 0 \n",
845 "comedy drama romance tin cup golf nickname love... ... 0 \n",
846 "comedy crime drama life baseball year wrongful ... ... 0 \n",
847 "comedy drama romance reality bite generation ho... ... 0 \n",
848 "biography drama music runaway rate revisionist ... ... 0 \n",
849 "\n",
850 " cryptoanalyst plough \\\n",
851 "TagsText \n",
852 "drama shawshank redemption wrongful imprisonmen... 0 0 \n",
853 "action crime drama dark knight dc comic_strip j... 0 0 \n",
854 "action adventure sci fi inception dream ambiguo... 0 0 \n",
855 "drama fight club fight surprise end anti establ... 0 0 \n",
856 "crime drama pulp fiction nonlinear timeline ove... 0 0 \n",
857 "... ... ... \n",
858 "fantasy horror short un chien andalou surrealis... 0 0 \n",
859 "comedy drama romance tin cup golf nickname love... 0 0 \n",
860 "comedy crime drama life baseball year wrongful ... 0 0 \n",
861 "comedy drama romance reality bite generation ho... 0 0 \n",
862 "biography drama music runaway rate revisionist ... 0 0 \n",
863 "\n",
864 " solitary scottsdale \\\n",
865 "TagsText \n",
866 "drama shawshank redemption wrongful imprisonmen... 0 0 \n",
867 "action crime drama dark knight dc comic_strip j... 0 0 \n",
868 "action adventure sci fi inception dream ambiguo... 0 0 \n",
869 "drama fight club fight surprise end anti establ... 0 0 \n",
870 "crime drama pulp fiction nonlinear timeline ove... 0 0 \n",
871 "... ... ... \n",
872 "fantasy horror short un chien andalou surrealis... 0 0 \n",
873 "comedy drama romance tin cup golf nickname love... 0 0 \n",
874 "comedy crime drama life baseball year wrongful ... 0 0 \n",
875 "comedy drama romance reality bite generation ho... 0 0 \n",
876 "biography drama music runaway rate revisionist ... 0 0 \n",
877 "\n",
878 " jovi seashell \\\n",
879 "TagsText \n",
880 "drama shawshank redemption wrongful imprisonmen... 0 0 \n",
881 "action crime drama dark knight dc comic_strip j... 0 0 \n",
882 "action adventure sci fi inception dream ambiguo... 0 0 \n",
883 "drama fight club fight surprise end anti establ... 0 0 \n",
884 "crime drama pulp fiction nonlinear timeline ove... 0 0 \n",
885 "... ... ... \n",
886 "fantasy horror short un chien andalou surrealis... 0 0 \n",
887 "comedy drama romance tin cup golf nickname love... 0 0 \n",
888 "comedy crime drama life baseball year wrongful ... 0 0 \n",
889 "comedy drama romance reality bite generation ho... 0 0 \n",
890 "biography drama music runaway rate revisionist ... 0 0 \n",
891 "\n",
892 " electrical headquarters \\\n",
893 "TagsText \n",
894 "drama shawshank redemption wrongful imprisonmen... 0 0 \n",
895 "action crime drama dark knight dc comic_strip j... 0 0 \n",
896 "action adventure sci fi inception dream ambiguo... 0 0 \n",
897 "drama fight club fight surprise end anti establ... 0 0 \n",
898 "crime drama pulp fiction nonlinear timeline ove... 0 0 \n",
899 "... ... ... \n",
900 "fantasy horror short un chien andalou surrealis... 0 0 \n",
901 "comedy drama romance tin cup golf nickname love... 0 0 \n",
902 "comedy crime drama life baseball year wrongful ... 0 0 \n",
903 "comedy drama romance reality bite generation ho... 0 0 \n",
904 "biography drama music runaway rate revisionist ... 0 0 \n",
905 "\n",
906 " victory \n",
907 "TagsText \n",
908 "drama shawshank redemption wrongful imprisonmen... 0 \n",
909 "action crime drama dark knight dc comic_strip j... 0 \n",
910 "action adventure sci fi inception dream ambiguo... 0 \n",
911 "drama fight club fight surprise end anti establ... 0 \n",
912 "crime drama pulp fiction nonlinear timeline ove... 0 \n",
913 "... ... \n",
914 "fantasy horror short un chien andalou surrealis... 0 \n",
915 "comedy drama romance tin cup golf nickname love... 0 \n",
916 "comedy crime drama life baseball year wrongful ... 0 \n",
917 "comedy drama romance reality bite generation ho... 0 \n",
918 "biography drama music runaway rate revisionist ... 0 \n",
919 "\n",
920 "[4000 rows x 17825 columns]"
921 ]
922 },
923 "execution_count": 13,
924 "metadata": {},
925 "output_type": "execute_result"
926 }
927 ],
928 "source": [
929 "vector_matrix"
930 ]
931 },
932 {
933 "cell_type": "code",
934 "execution_count": null,
935 "id": "29c2443c",
936 "metadata": {},
937 "outputs": [],
938 "source": []
939 },
940 {
941 "cell_type": "code",
942 "execution_count": null,
943 "id": "4d8ff8b5",
944 "metadata": {},
945 "outputs": [],
946 "source": []
947 },
948 {
949 "cell_type": "code",
950 "execution_count": null,
951 "id": "b191715e",
952 "metadata": {},
953 "outputs": [],
954 "source": []
955 },
956 {
957 "cell_type": "code",
958 "execution_count": null,
959 "id": "a7fc3a17",
960 "metadata": {},
961 "outputs": [],
962 "source": []
963 },
964 {
965 "cell_type": "code",
966 "execution_count": null,
967 "id": "66c24dae",
968 "metadata": {},
969 "outputs": [],
970 "source": []
971 },
972 {
973 "cell_type": "code",
974 "execution_count": null,
975 "id": "13500162",
976 "metadata": {},
977 "outputs": [],
978 "source": []
979 },
980 {
981 "cell_type": "code",
982 "execution_count": null,
983 "id": "e4dcfadd",
984 "metadata": {},
985 "outputs": [],
986 "source": []
987 },
988 {
989 "cell_type": "code",
990 "execution_count": null,
991 "id": "342afe33",
992 "metadata": {},
993 "outputs": [],
994 "source": []
995 },
996 {
997 "cell_type": "code",
998 "execution_count": null,
999 "id": "b130cab2",
1000 "metadata": {},
1001 "outputs": [],
1002 "source": []
1003 },
1004 {
1005 "cell_type": "code",
1006 "execution_count": 29,
1007 "id": "9f98fed8",
1008 "metadata": {},
1009 "outputs": [],
1010 "source": [
1011 "movie_index=2\n",
1012 "input_vector= vector_matrix.iloc[movie_index , :].to_numpy()"
1013 ]
1014 },
1015 {
1016 "cell_type": "code",
1017 "execution_count": 30,
1018 "id": "d9312665",
1019 "metadata": {},
1020 "outputs": [
1021 {
1022 "data": {
1023 "text/plain": [
1024 "array([0, 0, 0, ..., 0, 0, 0], dtype=int64)"
1025 ]
1026 },
1027 "execution_count": 30,
1028 "metadata": {},
1029 "output_type": "execute_result"
1030 }
1031 ],
1032 "source": [
1033 "input_vector"
1034 ]
1035 },
1036 {
1037 "cell_type": "code",
1038 "execution_count": null,
1039 "id": "23bcaa0e",
1040 "metadata": {},
1041 "outputs": [],
1042 "source": []
1043 },
1044 {
1045 "cell_type": "code",
1046 "execution_count": 31,
1047 "id": "ea88d1b8",
1048 "metadata": {},
1049 "outputs": [],
1050 "source": [
1051 "distance=[]\n",
1052 "def dis(vector):\n",
1053 " vector=vector.to_numpy()\n",
1054 " distance.append(pow(pow((input_vector-vector),2).sum(),1/2))\n",
1055 "\n",
1056 "z=vector_matrix.T.apply(lambda x: dis(x))\n",
1057 "del z\n",
1058 "\n"
1059 ]
1060 },
1061 {
1062 "cell_type": "code",
1063 "execution_count": null,
1064 "id": "ba28b470",
1065 "metadata": {},
1066 "outputs": [],
1067 "source": []
1068 },
1069 {
1070 "cell_type": "code",
1071 "execution_count": 32,
1072 "id": "420b16a0",
1073 "metadata": {},
1074 "outputs": [
1075 {
1076 "data": {
1077 "text/html": [
1078 "<div>\n",
1079 "<style scoped>\n",
1080 " .dataframe tbody tr th:only-of-type {\n",
1081 " vertical-align: middle;\n",
1082 " }\n",
1083 "\n",
1084 " .dataframe tbody tr th {\n",
1085 " vertical-align: top;\n",
1086 " }\n",
1087 "\n",
1088 " .dataframe thead th {\n",
1089 " text-align: right;\n",
1090 " }\n",
1091 "</style>\n",
1092 "<table border=\"1\" class=\"dataframe\">\n",
1093 " <thead>\n",
1094 " <tr style=\"text-align: right;\">\n",
1095 " <th></th>\n",
1096 " <th>index</th>\n",
1097 " <th>titleId</th>\n",
1098 " <th>title</th>\n",
1099 " <th>genres</th>\n",
1100 " <th>TagsText</th>\n",
1101 " <th>distance</th>\n",
1102 " </tr>\n",
1103 " </thead>\n",
1104 " <tbody>\n",
1105 " <tr>\n",
1106 " <th>0</th>\n",
1107 " <td>2</td>\n",
1108 " <td>tt1375666</td>\n",
1109 " <td>Inception</td>\n",
1110 " <td>Action Adventure Sci-Fi</td>\n",
1111 " <td>action adventure sci fi inception dream ambigu...</td>\n",
1112 " <td>0.000000</td>\n",
1113 " </tr>\n",
1114 " <tr>\n",
1115 " <th>1</th>\n",
1116 " <td>2258</td>\n",
1117 " <td>tt5057054</td>\n",
1118 " <td>Jack Ryan</td>\n",
1119 " <td>Action Drama Thriller</td>\n",
1120 " <td>action drama thriller jack ryan jack ryan char...</td>\n",
1121 " <td>2.000000</td>\n",
1122 " </tr>\n",
1123 " <tr>\n",
1124 " <th>2</th>\n",
1125 " <td>791</td>\n",
1126 " <td>tt0285403</td>\n",
1127 " <td>Scrubs</td>\n",
1128 " <td>Comedy Drama</td>\n",
1129 " <td>comedy drama scrub bromance hospital californi...</td>\n",
1130 " <td>2.000000</td>\n",
1131 " </tr>\n",
1132 " <tr>\n",
1133 " <th>3</th>\n",
1134 " <td>355</td>\n",
1135 " <td>tt0830515</td>\n",
1136 " <td>Quantum of Solace</td>\n",
1137 " <td>Action Adventure Thriller</td>\n",
1138 " <td>action adventure thriller quantum solace prett...</td>\n",
1139 " <td>2.000000</td>\n",
1140 " </tr>\n",
1141 " <tr>\n",
1142 " <th>4</th>\n",
1143 " <td>924</td>\n",
1144 " <td>tt0296572</td>\n",
1145 " <td>The Chronicles of Riddick</td>\n",
1146 " <td>Action Adventure Sci-Fi</td>\n",
1147 " <td>action adventure sci fi chronicle riddick shar...</td>\n",
1148 " <td>2.000000</td>\n",
1149 " </tr>\n",
1150 " <tr>\n",
1151 " <th>5</th>\n",
1152 " <td>3874</td>\n",
1153 " <td>tt0083399</td>\n",
1154 " <td>Cheers</td>\n",
1155 " <td>Comedy Drama</td>\n",
1156 " <td>comedy drama cheer bar bartender boston massac...</td>\n",
1157 " <td>2.000000</td>\n",
1158 " </tr>\n",
1159 " <tr>\n",
1160 " <th>6</th>\n",
1161 " <td>851</td>\n",
1162 " <td>tt0837562</td>\n",
1163 " <td>Hotel Transylvania</td>\n",
1164 " <td>Animation Comedy Family</td>\n",
1165 " <td>animation comedy family hotel transylvania mon...</td>\n",
1166 " <td>2.000000</td>\n",
1167 " </tr>\n",
1168 " <tr>\n",
1169 " <th>7</th>\n",
1170 " <td>1424</td>\n",
1171 " <td>tt0120681</td>\n",
1172 " <td>From Hell</td>\n",
1173 " <td>Horror Mystery Thriller</td>\n",
1174 " <td>horror mystery thriller hell victorian era que...</td>\n",
1175 " <td>2.000000</td>\n",
1176 " </tr>\n",
1177 " <tr>\n",
1178 " <th>8</th>\n",
1179 " <td>1278</td>\n",
1180 " <td>tt0918940</td>\n",
1181 " <td>The Legend of Tarzan</td>\n",
1182 " <td>Action Adventure Drama</td>\n",
1183 " <td>action adventure drama legend tarzan africa ju...</td>\n",
1184 " <td>2.000000</td>\n",
1185 " </tr>\n",
1186 " <tr>\n",
1187 " <th>9</th>\n",
1188 " <td>1323</td>\n",
1189 " <td>tt1528100</td>\n",
1190 " <td>Exodus: Gods and Kings</td>\n",
1191 " <td>Action Adventure Drama</td>\n",
1192 " <td>action adventure drama exodus god king mose ph...</td>\n",
1193 " <td>2.000000</td>\n",
1194 " </tr>\n",
1195 " <tr>\n",
1196 " <th>10</th>\n",
1197 " <td>621</td>\n",
1198 " <td>tt0413267</td>\n",
1199 " <td>Shrek the Third</td>\n",
1200 " <td>Adventure Animation Comedy</td>\n",
1201 " <td>adventure animation comedy shrek third far far...</td>\n",
1202 " <td>2.000000</td>\n",
1203 " </tr>\n",
1204 " <tr>\n",
1205 " <th>11</th>\n",
1206 " <td>9</td>\n",
1207 " <td>tt0167260</td>\n",
1208 " <td>The Lord of the Rings: The Return of the King</td>\n",
1209 " <td>Action Adventure Drama</td>\n",
1210 " <td>action adventure drama lord ring return king e...</td>\n",
1211 " <td>2.000000</td>\n",
1212 " </tr>\n",
1213 " <tr>\n",
1214 " <th>12</th>\n",
1215 " <td>3469</td>\n",
1216 " <td>tt1569923</td>\n",
1217 " <td>Batman: Under the Red Hood</td>\n",
1218 " <td>Action Animation Crime</td>\n",
1219 " <td>action animation crime batman red hood robin c...</td>\n",
1220 " <td>2.236068</td>\n",
1221 " </tr>\n",
1222 " <tr>\n",
1223 " <th>13</th>\n",
1224 " <td>739</td>\n",
1225 " <td>tt0257044</td>\n",
1226 " <td>Road to Perdition</td>\n",
1227 " <td>Crime Drama Thriller</td>\n",
1228 " <td>crime drama thriller road perdition base comic...</td>\n",
1229 " <td>2.236068</td>\n",
1230 " </tr>\n",
1231 " <tr>\n",
1232 " <th>14</th>\n",
1233 " <td>3865</td>\n",
1234 " <td>tt0019254</td>\n",
1235 " <td>La passion de Jeanne d'Arc</td>\n",
1236 " <td>Biography Drama History</td>\n",
1237 " <td>biography drama history la passion de jeanne a...</td>\n",
1238 " <td>2.236068</td>\n",
1239 " </tr>\n",
1240 " <tr>\n",
1241 " <th>15</th>\n",
1242 " <td>1590</td>\n",
1243 " <td>tt1351685</td>\n",
1244 " <td>Jack the Giant Slayer</td>\n",
1245 " <td>Adventure Comedy Family</td>\n",
1246 " <td>adventure comedy family jack giant slayer open...</td>\n",
1247 " <td>2.236068</td>\n",
1248 " </tr>\n",
1249 " <tr>\n",
1250 " <th>16</th>\n",
1251 " <td>1012</td>\n",
1252 " <td>tt0374900</td>\n",
1253 " <td>Napoleon Dynamite</td>\n",
1254 " <td>Comedy</td>\n",
1255 " <td>comedy napoleon dynamite high school family re...</td>\n",
1256 " <td>2.236068</td>\n",
1257 " </tr>\n",
1258 " <tr>\n",
1259 " <th>17</th>\n",
1260 " <td>1566</td>\n",
1261 " <td>tt0472033</td>\n",
1262 " <td>9</td>\n",
1263 " <td>Action Adventure Animation</td>\n",
1264 " <td>action adventure animation post apocalypse alt...</td>\n",
1265 " <td>2.236068</td>\n",
1266 " </tr>\n",
1267 " <tr>\n",
1268 " <th>18</th>\n",
1269 " <td>3260</td>\n",
1270 " <td>tt3332064</td>\n",
1271 " <td>Pan</td>\n",
1272 " <td>Adventure Comedy Family</td>\n",
1273 " <td>adventure comedy family pan orphan child hero ...</td>\n",
1274 " <td>2.236068</td>\n",
1275 " </tr>\n",
1276 " <tr>\n",
1277 " <th>19</th>\n",
1278 " <td>1381</td>\n",
1279 " <td>tt0120891</td>\n",
1280 " <td>Wild Wild West</td>\n",
1281 " <td>Action Comedy Sci-Fi</td>\n",
1282 " <td>action comedy sci fi wild wild west utah buddy...</td>\n",
1283 " <td>2.236068</td>\n",
1284 " </tr>\n",
1285 " <tr>\n",
1286 " <th>20</th>\n",
1287 " <td>3900</td>\n",
1288 " <td>tt0060107</td>\n",
1289 " <td>Andrey Rublev</td>\n",
1290 " <td>Biography Drama History</td>\n",
1291 " <td>biography drama history andrey rublev th centu...</td>\n",
1292 " <td>2.236068</td>\n",
1293 " </tr>\n",
1294 " <tr>\n",
1295 " <th>21</th>\n",
1296 " <td>2405</td>\n",
1297 " <td>tt0105665</td>\n",
1298 " <td>Twin Peaks: Fire Walk with Me</td>\n",
1299 " <td>Drama Horror Mystery</td>\n",
1300 " <td>drama horror mystery twin peak fire walk I sur...</td>\n",
1301 " <td>2.236068</td>\n",
1302 " </tr>\n",
1303 " <tr>\n",
1304 " <th>22</th>\n",
1305 " <td>2367</td>\n",
1306 " <td>tt0013442</td>\n",
1307 " <td>Nosferatu, eine Symphonie des Grauens</td>\n",
1308 " <td>Fantasy Horror</td>\n",
1309 " <td>fantasy horror nosferatu eine symphonie des gr...</td>\n",
1310 " <td>2.236068</td>\n",
1311 " </tr>\n",
1312 " <tr>\n",
1313 " <th>23</th>\n",
1314 " <td>960</td>\n",
1315 " <td>tt1132620</td>\n",
1316 " <td>Män som hatar kvinnor</td>\n",
1317 " <td>Crime Drama Mystery</td>\n",
1318 " <td>crime drama mystery som hatar kvinnor disappea...</td>\n",
1319 " <td>2.236068</td>\n",
1320 " </tr>\n",
1321 " <tr>\n",
1322 " <th>24</th>\n",
1323 " <td>1310</td>\n",
1324 " <td>tt0442933</td>\n",
1325 " <td>Beowulf</td>\n",
1326 " <td>Action Adventure Animation</td>\n",
1327 " <td>action adventure animation beowulf adult anima...</td>\n",
1328 " <td>2.236068</td>\n",
1329 " </tr>\n",
1330 " <tr>\n",
1331 " <th>25</th>\n",
1332 " <td>212</td>\n",
1333 " <td>tt0120363</td>\n",
1334 " <td>Toy Story 2</td>\n",
1335 " <td>Adventure Animation Comedy</td>\n",
1336 " <td>adventure animation comedy toy story toy toy c...</td>\n",
1337 " <td>2.236068</td>\n",
1338 " </tr>\n",
1339 " <tr>\n",
1340 " <th>26</th>\n",
1341 " <td>1201</td>\n",
1342 " <td>tt1583421</td>\n",
1343 " <td>G.I. Joe: Retaliation</td>\n",
1344 " <td>Action Adventure Sci-Fi</td>\n",
1345 " <td>action adventure sci fi joe retaliation gi joe...</td>\n",
1346 " <td>2.236068</td>\n",
1347 " </tr>\n",
1348 " <tr>\n",
1349 " <th>27</th>\n",
1350 " <td>255</td>\n",
1351 " <td>tt1343092</td>\n",
1352 " <td>The Great Gatsby</td>\n",
1353 " <td>Drama Romance</td>\n",
1354 " <td>drama romance great gatsby extramarital affair...</td>\n",
1355 " <td>2.236068</td>\n",
1356 " </tr>\n",
1357 " <tr>\n",
1358 " <th>28</th>\n",
1359 " <td>2681</td>\n",
1360 " <td>tt0116778</td>\n",
1361 " <td>Kingpin</td>\n",
1362 " <td>Comedy Sport</td>\n",
1363 " <td>comedy sport kingpin bowling amish road privat...</td>\n",
1364 " <td>2.449490</td>\n",
1365 " </tr>\n",
1366 " <tr>\n",
1367 " <th>29</th>\n",
1368 " <td>2987</td>\n",
1369 " <td>tt0841046</td>\n",
1370 " <td>Walk Hard: The Dewey Cox Story</td>\n",
1371 " <td>Comedy Music</td>\n",
1372 " <td>comedy music walk hard dewey cox story referen...</td>\n",
1373 " <td>2.449490</td>\n",
1374 " </tr>\n",
1375 " <tr>\n",
1376 " <th>30</th>\n",
1377 " <td>1878</td>\n",
1378 " <td>tt0337741</td>\n",
1379 " <td>Something's Gotta Give</td>\n",
1380 " <td>Comedy Drama Romance</td>\n",
1381 " <td>comedy drama romance something get ta give mat...</td>\n",
1382 " <td>2.449490</td>\n",
1383 " </tr>\n",
1384 " <tr>\n",
1385 " <th>31</th>\n",
1386 " <td>1244</td>\n",
1387 " <td>tt0986263</td>\n",
1388 " <td>Surrogates</td>\n",
1389 " <td>Action Sci-Fi Thriller</td>\n",
1390 " <td>action sci fi thriller surrogate future robot ...</td>\n",
1391 " <td>2.449490</td>\n",
1392 " </tr>\n",
1393 " <tr>\n",
1394 " <th>32</th>\n",
1395 " <td>404</td>\n",
1396 " <td>tt4425200</td>\n",
1397 " <td>John Wick: Chapter 2</td>\n",
1398 " <td>Action Crime Thriller</td>\n",
1399 " <td>action crime thriller john wick chapter one ar...</td>\n",
1400 " <td>2.449490</td>\n",
1401 " </tr>\n",
1402 " <tr>\n",
1403 " <th>33</th>\n",
1404 " <td>2958</td>\n",
1405 " <td>tt7939766</td>\n",
1406 " <td>I'm Thinking of Ending Things</td>\n",
1407 " <td>Drama Thriller</td>\n",
1408 " <td>drama thriller thinking end thing winter demen...</td>\n",
1409 " <td>2.449490</td>\n",
1410 " </tr>\n",
1411 " <tr>\n",
1412 " <th>34</th>\n",
1413 " <td>2687</td>\n",
1414 " <td>tt4849438</td>\n",
1415 " <td>Bãhubali 2: The Conclusion</td>\n",
1416 " <td>Action Drama</td>\n",
1417 " <td>action drama bahubali conclusion sequel second...</td>\n",
1418 " <td>2.449490</td>\n",
1419 " </tr>\n",
1420 " <tr>\n",
1421 " <th>35</th>\n",
1422 " <td>1621</td>\n",
1423 " <td>tt1355642</td>\n",
1424 " <td>Hagane no renkinjutsushi</td>\n",
1425 " <td>Action Adventure Animation</td>\n",
1426 " <td>action adventure animation hagane renkinjutsus...</td>\n",
1427 " <td>2.449490</td>\n",
1428 " </tr>\n",
1429 " <tr>\n",
1430 " <th>36</th>\n",
1431 " <td>2688</td>\n",
1432 " <td>tt0317648</td>\n",
1433 " <td>Hidalgo</td>\n",
1434 " <td>Action Adventure Biography</td>\n",
1435 " <td>action adventure biography hidalgo glaci natio...</td>\n",
1436 " <td>2.449490</td>\n",
1437 " </tr>\n",
1438 " <tr>\n",
1439 " <th>37</th>\n",
1440 " <td>3707</td>\n",
1441 " <td>tt2403776</td>\n",
1442 " <td>Shadow and Bone</td>\n",
1443 " <td>Action Adventure Drama</td>\n",
1444 " <td>action adventure drama shadow bone power magic...</td>\n",
1445 " <td>2.449490</td>\n",
1446 " </tr>\n",
1447 " <tr>\n",
1448 " <th>38</th>\n",
1449 " <td>199</td>\n",
1450 " <td>tt3748528</td>\n",
1451 " <td>Rogue One</td>\n",
1452 " <td>Action Adventure Sci-Fi</td>\n",
1453 " <td>action adventure sci fi rogue one star war los...</td>\n",
1454 " <td>2.449490</td>\n",
1455 " </tr>\n",
1456 " <tr>\n",
1457 " <th>39</th>\n",
1458 " <td>3700</td>\n",
1459 " <td>tt0180073</td>\n",
1460 " <td>Quills</td>\n",
1461 " <td>Biography Drama</td>\n",
1462 " <td>biography drama quill writer insane asylum bon...</td>\n",
1463 " <td>2.449490</td>\n",
1464 " </tr>\n",
1465 " <tr>\n",
1466 " <th>40</th>\n",
1467 " <td>3706</td>\n",
1468 " <td>tt0087985</td>\n",
1469 " <td>Red Dawn</td>\n",
1470 " <td>Action Drama</td>\n",
1471 " <td>action drama red dawn russkie teenage propagan...</td>\n",
1472 " <td>2.449490</td>\n",
1473 " </tr>\n",
1474 " <tr>\n",
1475 " <th>41</th>\n",
1476 " <td>405</td>\n",
1477 " <td>tt1217209</td>\n",
1478 " <td>Brave</td>\n",
1479 " <td>Adventure Animation Comedy</td>\n",
1480 " <td>adventure animation comedy brave princess moth...</td>\n",
1481 " <td>2.449490</td>\n",
1482 " </tr>\n",
1483 " <tr>\n",
1484 " <th>42</th>\n",
1485 " <td>202</td>\n",
1486 " <td>tt0304141</td>\n",
1487 " <td>Harry Potter and the Prisoner of Azkaban</td>\n",
1488 " <td>Adventure Family Fantasy</td>\n",
1489 " <td>adventure family fantasy harry potter prisoner...</td>\n",
1490 " <td>2.449490</td>\n",
1491 " </tr>\n",
1492 " <tr>\n",
1493 " <th>43</th>\n",
1494 " <td>2961</td>\n",
1495 " <td>tt4635276</td>\n",
1496 " <td>Master of None</td>\n",
1497 " <td>Comedy Drama</td>\n",
1498 " <td>comedy drama master none satire new york italy...</td>\n",
1499 " <td>2.449490</td>\n",
1500 " </tr>\n",
1501 " <tr>\n",
1502 " <th>44</th>\n",
1503 " <td>2096</td>\n",
1504 " <td>tt0462504</td>\n",
1505 " <td>Rescue Dawn</td>\n",
1506 " <td>Action Biography Drama</td>\n",
1507 " <td>action biography drama rescue dawn tie upside ...</td>\n",
1508 " <td>2.449490</td>\n",
1509 " </tr>\n",
1510 " <tr>\n",
1511 " <th>45</th>\n",
1512 " <td>1616</td>\n",
1513 " <td>tt0088258</td>\n",
1514 " <td>This Is Spinal Tap</td>\n",
1515 " <td>Comedy Music</td>\n",
1516 " <td>comedy music spinal tap mockumentary parody he...</td>\n",
1517 " <td>2.449490</td>\n",
1518 " </tr>\n",
1519 " <tr>\n",
1520 " <th>46</th>\n",
1521 " <td>3316</td>\n",
1522 " <td>tt8064302</td>\n",
1523 " <td>Dead to Me</td>\n",
1524 " <td>Comedy Drama</td>\n",
1525 " <td>comedy drama dead I hit run grief breast cance...</td>\n",
1526 " <td>2.449490</td>\n",
1527 " </tr>\n",
1528 " <tr>\n",
1529 " <th>47</th>\n",
1530 " <td>1101</td>\n",
1531 " <td>tt2404435</td>\n",
1532 " <td>The Magnificent Seven</td>\n",
1533 " <td>Action Adventure Western</td>\n",
1534 " <td>action adventure western magnificent seven sho...</td>\n",
1535 " <td>2.449490</td>\n",
1536 " </tr>\n",
1537 " <tr>\n",
1538 " <th>48</th>\n",
1539 " <td>823</td>\n",
1540 " <td>tt3450958</td>\n",
1541 " <td>War for the Planet of the Apes</td>\n",
1542 " <td>Action Adventure Drama</td>\n",
1543 " <td>action adventure drama war planet ape ape plan...</td>\n",
1544 " <td>2.449490</td>\n",
1545 " </tr>\n",
1546 " <tr>\n",
1547 " <th>49</th>\n",
1548 " <td>2361</td>\n",
1549 " <td>tt0090264</td>\n",
1550 " <td>A View to a Kill</td>\n",
1551 " <td>Action Adventure Thriller</td>\n",
1552 " <td>action adventure thriller view kill official j...</td>\n",
1553 " <td>2.449490</td>\n",
1554 " </tr>\n",
1555 " </tbody>\n",
1556 "</table>\n",
1557 "</div>"
1558 ],
1559 "text/plain": [
1560 " index titleId title \\\n",
1561 "0 2 tt1375666 Inception \n",
1562 "1 2258 tt5057054 Jack Ryan \n",
1563 "2 791 tt0285403 Scrubs \n",
1564 "3 355 tt0830515 Quantum of Solace \n",
1565 "4 924 tt0296572 The Chronicles of Riddick \n",
1566 "5 3874 tt0083399 Cheers \n",
1567 "6 851 tt0837562 Hotel Transylvania \n",
1568 "7 1424 tt0120681 From Hell \n",
1569 "8 1278 tt0918940 The Legend of Tarzan \n",
1570 "9 1323 tt1528100 Exodus: Gods and Kings \n",
1571 "10 621 tt0413267 Shrek the Third \n",
1572 "11 9 tt0167260 The Lord of the Rings: The Return of the King \n",
1573 "12 3469 tt1569923 Batman: Under the Red Hood \n",
1574 "13 739 tt0257044 Road to Perdition \n",
1575 "14 3865 tt0019254 La passion de Jeanne d'Arc \n",
1576 "15 1590 tt1351685 Jack the Giant Slayer \n",
1577 "16 1012 tt0374900 Napoleon Dynamite \n",
1578 "17 1566 tt0472033 9 \n",
1579 "18 3260 tt3332064 Pan \n",
1580 "19 1381 tt0120891 Wild Wild West \n",
1581 "20 3900 tt0060107 Andrey Rublev \n",
1582 "21 2405 tt0105665 Twin Peaks: Fire Walk with Me \n",
1583 "22 2367 tt0013442 Nosferatu, eine Symphonie des Grauens \n",
1584 "23 960 tt1132620 Män som hatar kvinnor \n",
1585 "24 1310 tt0442933 Beowulf \n",
1586 "25 212 tt0120363 Toy Story 2 \n",
1587 "26 1201 tt1583421 G.I. Joe: Retaliation \n",
1588 "27 255 tt1343092 The Great Gatsby \n",
1589 "28 2681 tt0116778 Kingpin \n",
1590 "29 2987 tt0841046 Walk Hard: The Dewey Cox Story \n",
1591 "30 1878 tt0337741 Something's Gotta Give \n",
1592 "31 1244 tt0986263 Surrogates \n",
1593 "32 404 tt4425200 John Wick: Chapter 2 \n",
1594 "33 2958 tt7939766 I'm Thinking of Ending Things \n",
1595 "34 2687 tt4849438 Bãhubali 2: The Conclusion \n",
1596 "35 1621 tt1355642 Hagane no renkinjutsushi \n",
1597 "36 2688 tt0317648 Hidalgo \n",
1598 "37 3707 tt2403776 Shadow and Bone \n",
1599 "38 199 tt3748528 Rogue One \n",
1600 "39 3700 tt0180073 Quills \n",
1601 "40 3706 tt0087985 Red Dawn \n",
1602 "41 405 tt1217209 Brave \n",
1603 "42 202 tt0304141 Harry Potter and the Prisoner of Azkaban \n",
1604 "43 2961 tt4635276 Master of None \n",
1605 "44 2096 tt0462504 Rescue Dawn \n",
1606 "45 1616 tt0088258 This Is Spinal Tap \n",
1607 "46 3316 tt8064302 Dead to Me \n",
1608 "47 1101 tt2404435 The Magnificent Seven \n",
1609 "48 823 tt3450958 War for the Planet of the Apes \n",
1610 "49 2361 tt0090264 A View to a Kill \n",
1611 "\n",
1612 " genres \\\n",
1613 "0 Action Adventure Sci-Fi \n",
1614 "1 Action Drama Thriller \n",
1615 "2 Comedy Drama \n",
1616 "3 Action Adventure Thriller \n",
1617 "4 Action Adventure Sci-Fi \n",
1618 "5 Comedy Drama \n",
1619 "6 Animation Comedy Family \n",
1620 "7 Horror Mystery Thriller \n",
1621 "8 Action Adventure Drama \n",
1622 "9 Action Adventure Drama \n",
1623 "10 Adventure Animation Comedy \n",
1624 "11 Action Adventure Drama \n",
1625 "12 Action Animation Crime \n",
1626 "13 Crime Drama Thriller \n",
1627 "14 Biography Drama History \n",
1628 "15 Adventure Comedy Family \n",
1629 "16 Comedy \n",
1630 "17 Action Adventure Animation \n",
1631 "18 Adventure Comedy Family \n",
1632 "19 Action Comedy Sci-Fi \n",
1633 "20 Biography Drama History \n",
1634 "21 Drama Horror Mystery \n",
1635 "22 Fantasy Horror \n",
1636 "23 Crime Drama Mystery \n",
1637 "24 Action Adventure Animation \n",
1638 "25 Adventure Animation Comedy \n",
1639 "26 Action Adventure Sci-Fi \n",
1640 "27 Drama Romance \n",
1641 "28 Comedy Sport \n",
1642 "29 Comedy Music \n",
1643 "30 Comedy Drama Romance \n",
1644 "31 Action Sci-Fi Thriller \n",
1645 "32 Action Crime Thriller \n",
1646 "33 Drama Thriller \n",
1647 "34 Action Drama \n",
1648 "35 Action Adventure Animation \n",
1649 "36 Action Adventure Biography \n",
1650 "37 Action Adventure Drama \n",
1651 "38 Action Adventure Sci-Fi \n",
1652 "39 Biography Drama \n",
1653 "40 Action Drama \n",
1654 "41 Adventure Animation Comedy \n",
1655 "42 Adventure Family Fantasy \n",
1656 "43 Comedy Drama \n",
1657 "44 Action Biography Drama \n",
1658 "45 Comedy Music \n",
1659 "46 Comedy Drama \n",
1660 "47 Action Adventure Western \n",
1661 "48 Action Adventure Drama \n",
1662 "49 Action Adventure Thriller \n",
1663 "\n",
1664 " TagsText distance \n",
1665 "0 action adventure sci fi inception dream ambigu... 0.000000 \n",
1666 "1 action drama thriller jack ryan jack ryan char... 2.000000 \n",
1667 "2 comedy drama scrub bromance hospital californi... 2.000000 \n",
1668 "3 action adventure thriller quantum solace prett... 2.000000 \n",
1669 "4 action adventure sci fi chronicle riddick shar... 2.000000 \n",
1670 "5 comedy drama cheer bar bartender boston massac... 2.000000 \n",
1671 "6 animation comedy family hotel transylvania mon... 2.000000 \n",
1672 "7 horror mystery thriller hell victorian era que... 2.000000 \n",
1673 "8 action adventure drama legend tarzan africa ju... 2.000000 \n",
1674 "9 action adventure drama exodus god king mose ph... 2.000000 \n",
1675 "10 adventure animation comedy shrek third far far... 2.000000 \n",
1676 "11 action adventure drama lord ring return king e... 2.000000 \n",
1677 "12 action animation crime batman red hood robin c... 2.236068 \n",
1678 "13 crime drama thriller road perdition base comic... 2.236068 \n",
1679 "14 biography drama history la passion de jeanne a... 2.236068 \n",
1680 "15 adventure comedy family jack giant slayer open... 2.236068 \n",
1681 "16 comedy napoleon dynamite high school family re... 2.236068 \n",
1682 "17 action adventure animation post apocalypse alt... 2.236068 \n",
1683 "18 adventure comedy family pan orphan child hero ... 2.236068 \n",
1684 "19 action comedy sci fi wild wild west utah buddy... 2.236068 \n",
1685 "20 biography drama history andrey rublev th centu... 2.236068 \n",
1686 "21 drama horror mystery twin peak fire walk I sur... 2.236068 \n",
1687 "22 fantasy horror nosferatu eine symphonie des gr... 2.236068 \n",
1688 "23 crime drama mystery som hatar kvinnor disappea... 2.236068 \n",
1689 "24 action adventure animation beowulf adult anima... 2.236068 \n",
1690 "25 adventure animation comedy toy story toy toy c... 2.236068 \n",
1691 "26 action adventure sci fi joe retaliation gi joe... 2.236068 \n",
1692 "27 drama romance great gatsby extramarital affair... 2.236068 \n",
1693 "28 comedy sport kingpin bowling amish road privat... 2.449490 \n",
1694 "29 comedy music walk hard dewey cox story referen... 2.449490 \n",
1695 "30 comedy drama romance something get ta give mat... 2.449490 \n",
1696 "31 action sci fi thriller surrogate future robot ... 2.449490 \n",
1697 "32 action crime thriller john wick chapter one ar... 2.449490 \n",
1698 "33 drama thriller thinking end thing winter demen... 2.449490 \n",
1699 "34 action drama bahubali conclusion sequel second... 2.449490 \n",
1700 "35 action adventure animation hagane renkinjutsus... 2.449490 \n",
1701 "36 action adventure biography hidalgo glaci natio... 2.449490 \n",
1702 "37 action adventure drama shadow bone power magic... 2.449490 \n",
1703 "38 action adventure sci fi rogue one star war los... 2.449490 \n",
1704 "39 biography drama quill writer insane asylum bon... 2.449490 \n",
1705 "40 action drama red dawn russkie teenage propagan... 2.449490 \n",
1706 "41 adventure animation comedy brave princess moth... 2.449490 \n",
1707 "42 adventure family fantasy harry potter prisoner... 2.449490 \n",
1708 "43 comedy drama master none satire new york italy... 2.449490 \n",
1709 "44 action biography drama rescue dawn tie upside ... 2.449490 \n",
1710 "45 comedy music spinal tap mockumentary parody he... 2.449490 \n",
1711 "46 comedy drama dead I hit run grief breast cance... 2.449490 \n",
1712 "47 action adventure western magnificent seven sho... 2.449490 \n",
1713 "48 action adventure drama war planet ape ape plan... 2.449490 \n",
1714 "49 action adventure thriller view kill official j... 2.449490 "
1715 ]
1716 },
1717 "execution_count": 32,
1718 "metadata": {},
1719 "output_type": "execute_result"
1720 }
1721 ],
1722 "source": [
1723 "movies['distance']= pd.Series(distance)\n",
1724 "result=movies.sort_values(by='distance').reset_index()\n",
1725 "result[:50]"
1726 ]
1727 },
1728 {
1729 "cell_type": "code",
1730 "execution_count": null,
1731 "id": "aa7accf0",
1732 "metadata": {},
1733 "outputs": [],
1734 "source": []
1735 },
1736 {
1737 "cell_type": "code",
1738 "execution_count": 18,
1739 "id": "1ba45528",
1740 "metadata": {},
1741 "outputs": [
1742 {
1743 "data": {
1744 "text/plain": [
1745 "'drama fight club fight surprise end anti establishment insomnia multiple personality disorder base novel group therapy anti conformity anti capitalism disturb individual ikea black comedy graphic violence self destructiveness suicide attempt consumerism plot twist alter ego homoerotic break fourth wall dissociative identity disorder desire anti social behavior loss control mental instability alienation imaginary friend violence scene masochism cult film anti hero testicular cancer base book sadomasochism philosophy unreliable narrator schizophrenia overhear cult classic self injury famous twist soap fight support group control rage missionary position missionary position listen breast exam sound dream manic pixie dream underground sport breast drunkenness title fight beat pulp attraction'"
1746 ]
1747 },
1748 "execution_count": 18,
1749 "metadata": {},
1750 "output_type": "execute_result"
1751 }
1752 ],
1753 "source": [
1754 "result.TagsText[0]"
1755 ]
1756 },
1757 {
1758 "cell_type": "code",
1759 "execution_count": 19,
1760 "id": "bbe4330c",
1761 "metadata": {},
1762 "outputs": [
1763 {
1764 "data": {
1765 "text/plain": [
1766 "'action adventure fantasy great wall great wall china general monster mercenary queen invasion china gunpowder dark hero captive anti hero trust greed archer explosion soldier three word title white savior controversy live action animation psychotronic film aerial camera shot movie flop ancient china protagonist nunchaku title direct title direct title write wall attack horde commander army strategist bandit warrior general heroism cave escape soldier creature medallion dimensional imprisonment film start text thief drum alternate history backflip statue ponytail dining room secret military operation council cavalry tower crash landing'"
1767 ]
1768 },
1769 "execution_count": 19,
1770 "metadata": {},
1771 "output_type": "execute_result"
1772 }
1773 ],
1774 "source": [
1775 "result.TagsText[1925]"
1776 ]
1777 },
1778 {
1779 "cell_type": "code",
1780 "execution_count": null,
1781 "id": "bfd4af01",
1782 "metadata": {},
1783 "outputs": [],
1784 "source": []
1785 },
1786 {
1787 "cell_type": "code",
1788 "execution_count": null,
1789 "id": "97e8c39f",
1790 "metadata": {},
1791 "outputs": [],
1792 "source": []
1793 },
1794 {
1795 "cell_type": "code",
1796 "execution_count": null,
1797 "id": "9a85f97e",
1798 "metadata": {},
1799 "outputs": [],
1800 "source": []
1801 },
1802 {
1803 "cell_type": "code",
1804 "execution_count": null,
1805 "id": "cb66d6d4",
1806 "metadata": {},
1807 "outputs": [],
1808 "source": []
1809 },
1810 {
1811 "cell_type": "code",
1812 "execution_count": null,
1813 "id": "19f31bf5",
1814 "metadata": {},
1815 "outputs": [],
1816 "source": []
1817 },
1818 {
1819 "cell_type": "code",
1820 "execution_count": null,
1821 "id": "e3e21d93",
1822 "metadata": {},
1823 "outputs": [],
1824 "source": []
1825 },
1826 {
1827 "cell_type": "code",
1828 "execution_count": null,
1829 "id": "e918a3ff",
1830 "metadata": {},
1831 "outputs": [],
1832 "source": []
1833 },
1834 {
1835 "cell_type": "code",
1836 "execution_count": null,
1837 "id": "ab498210",
1838 "metadata": {},
1839 "outputs": [],
1840 "source": []
1841 },
1842 {
1843 "cell_type": "code",
1844 "execution_count": null,
1845 "id": "b1a4fce8",
1846 "metadata": {},
1847 "outputs": [],
1848 "source": []
1849 },
1850 {
1851 "cell_type": "code",
1852 "execution_count": null,
1853 "id": "779d7e49",
1854 "metadata": {},
1855 "outputs": [],
1856 "source": []
1857 },
1858 {
1859 "cell_type": "code",
1860 "execution_count": null,
1861 "id": "474493b9",
1862 "metadata": {},
1863 "outputs": [],
1864 "source": []
1865 },
1866 {
1867 "cell_type": "code",
1868 "execution_count": null,
1869 "id": "c4401214",
1870 "metadata": {},
1871 "outputs": [],
1872 "source": []
1873 },
1874 {
1875 "cell_type": "code",
1876 "execution_count": null,
1877 "id": "eef71b76",
1878 "metadata": {},
1879 "outputs": [],
1880 "source": []
1881 },
1882 {
1883 "cell_type": "code",
1884 "execution_count": null,
1885 "id": "d5cdb9d3",
1886 "metadata": {},
1887 "outputs": [],
1888 "source": []
1889 },
1890 {
1891 "cell_type": "code",
1892 "execution_count": null,
1893 "id": "f29dbf59",
1894 "metadata": {},
1895 "outputs": [],
1896 "source": []
1897 },
1898 {
1899 "cell_type": "code",
1900 "execution_count": null,
1901 "id": "3c6260b7",
1902 "metadata": {},
1903 "outputs": [],
1904 "source": []
1905 },
1906 {
1907 "cell_type": "code",
1908 "execution_count": null,
1909 "id": "f7759559",
1910 "metadata": {},
1911 "outputs": [],
1912 "source": []
1913 },
1914 {
1915 "cell_type": "code",
1916 "execution_count": null,
1917 "id": "f5c47a8e",
1918 "metadata": {},
1919 "outputs": [],
1920 "source": []
1921 },
1922 {
1923 "cell_type": "code",
1924 "execution_count": null,
1925 "id": "bbf3ed42",
1926 "metadata": {},
1927 "outputs": [],
1928 "source": []
1929 },
1930 {
1931 "cell_type": "code",
1932 "execution_count": null,
1933 "id": "a34e8170",
1934 "metadata": {},
1935 "outputs": [],
1936 "source": []
1937 },
1938 {
1939 "cell_type": "code",
1940 "execution_count": null,
1941 "id": "6836aaee",
1942 "metadata": {},
1943 "outputs": [],
1944 "source": []
1945 },
1946 {
1947 "cell_type": "code",
1948 "execution_count": null,
1949 "id": "62108108",
1950 "metadata": {},
1951 "outputs": [],
1952 "source": []
1953 },
1954 {
1955 "cell_type": "code",
1956 "execution_count": null,
1957 "id": "4d9056e4",
1958 "metadata": {},
1959 "outputs": [],
1960 "source": []
1961 },
1962 {
1963 "cell_type": "code",
1964 "execution_count": null,
1965 "id": "32a6fb56",
1966 "metadata": {},
1967 "outputs": [],
1968 "source": []
1969 },
1970 {
1971 "cell_type": "code",
1972 "execution_count": 35,
1973 "id": "79657421",
1974 "metadata": {},
1975 "outputs": [],
1976 "source": [
1977 "from difflib import SequenceMatcher\n",
1978 "\n",
1979 "def similar(a, b):\n",
1980 " return SequenceMatcher(None, a, b).ratio()"
1981 ]
1982 },
1983 {
1984 "cell_type": "code",
1985 "execution_count": 36,
1986 "id": "3757931b",
1987 "metadata": {},
1988 "outputs": [
1989 {
1990 "data": {
1991 "text/plain": [
1992 "0.7142857142857143"
1993 ]
1994 },
1995 "execution_count": 36,
1996 "metadata": {},
1997 "output_type": "execute_result"
1998 }
1999 ],
2000 "source": [
2001 "similar('autism', 'autistic')"
2002 ]
2003 },
2004 {
2005 "cell_type": "code",
2006 "execution_count": null,
2007 "id": "39fb1451",
2008 "metadata": {},
2009 "outputs": [],
2010 "source": []
2011 },
2012 {
2013 "cell_type": "code",
2014 "execution_count": 51,
2015 "id": "8de11685",
2016 "metadata": {},
2017 "outputs": [
2018 {
2019 "name": "stdout",
2020 "output_type": "stream",
2021 "text": [
2022 "Enter two space-separated words\n",
2023 "joker comedy\n",
2024 "joker True 6.114547 False\n",
2025 "comedy True 7.42965 False\n",
2026 "\n",
2027 "\n",
2028 "Similarity: 0.2508364\n"
2029 ]
2030 }
2031 ],
2032 "source": [
2033 "#import spacy\n",
2034 "\n",
2035 "#nlp = spacy.load('en_core_web_md')\n",
2036 "\n",
2037 "print(\"Enter two space-separated words\")\n",
2038 "words = input()\n",
2039 "\n",
2040 "tokens = nlp(words)\n",
2041 "\n",
2042 "for token in tokens:\n",
2043 "\t# Printing the following attributes of each token.\n",
2044 "\t# text: the word string, has_vector: if it contains\n",
2045 "\t# a vector representation in the model,\n",
2046 "\t# vector_norm: the algebraic norm of the vector,\n",
2047 "\t# is_oov: if the word is out of vocabulary.\n",
2048 "\tprint(token.text, token.has_vector, token.vector_norm, token.is_oov)\n",
2049 "\n",
2050 "token1, token2 = tokens[0], tokens[1]\n",
2051 "\n",
2052 "print(\"\\n\\nSimilarity:\", token1.similarity(token2))\n"
2053 ]
2054 },
2055 {
2056 "cell_type": "code",
2057 "execution_count": null,
2058 "id": "9b81d5d3",
2059 "metadata": {},
2060 "outputs": [],
2061 "source": []
2062 },
2063 {
2064 "cell_type": "code",
2065 "execution_count": null,
2066 "id": "b50aaabb",
2067 "metadata": {},
2068 "outputs": [],
2069 "source": []
2070 },
2071 {
2072 "cell_type": "code",
2073 "execution_count": null,
2074 "id": "106909b1",
2075 "metadata": {},
2076 "outputs": [],
2077 "source": []
2078 },
2079 {
2080 "cell_type": "code",
2081 "execution_count": null,
2082 "id": "21cd82b8",
2083 "metadata": {},
2084 "outputs": [],
2085 "source": []
2086 }
2087 ],
2088 "metadata": {
2089 "kernelspec": {
2090 "display_name": "Python 3",
2091 "language": "python",
2092 "name": "python3"
2093 },
2094 "language_info": {
2095 "codemirror_mode": {
2096 "name": "ipython",
2097 "version": 3
2098 },
2099 "file_extension": ".py",
2100 "mimetype": "text/x-python",
2101 "name": "python",
2102 "nbconvert_exporter": "python",
2103 "pygments_lexer": "ipython3",
2104 "version": "3.8.8"
2105 }
2106 },
2107 "nbformat": 4,
2108 "nbformat_minor": 5
2109 }
2110