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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "b33d3892",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'pandarallel'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Input \u001b[0;32mIn [49]\u001b[0m, in \u001b[0;36m<cell line: 12>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnltk\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mstem\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mporter\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m PorterStemmer\n\u001b[1;32m     10\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpattern\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtext\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01men\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m singularize\n\u001b[0;32m---> 12\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpandarallel\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m pandarallel \u001b[38;5;66;03m# Parallel workers on pandas dataframe\u001b[39;00m\n\u001b[1;32m     14\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01munidecode\u001b[39;00m\n\u001b[1;32m     15\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mre\u001b[39;00m \n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pandarallel'"
     ]
    }
   ],
   "source": [
    "import numpy as np # linear algebra\n",
    "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
    "import matplotlib.pyplot as plt # Used to do plots\n",
    "%matplotlib inline\n",
    "\n",
    "import nltk \n",
    "from nltk.corpus import stopwords # Stopwords \n",
    "from nltk.tokenize import word_tokenize # Word_tokenizer\n",
    "from nltk.stem.porter import PorterStemmer\n",
    "from pattern.text.en import singularize\n",
    "\n",
    "from pandarallel import pandarallel # Parallel workers on pandas dataframe\n",
    "\n",
    "import unidecode\n",
    "import re \n",
    "import time\n",
    "import string\n",
    "import statistics\n",
    "\n",
    "from datetime import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d1ef5e57",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting pattern\n",
      "  Downloading Pattern-3.6.0.tar.gz (22.2 MB)\n",
      "\u001b[2K     \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m22.2/22.2 MB\u001b[0m \u001b[31m201.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mm eta \u001b[36m0:00:01\u001b[0m[36m0:00:03\u001b[0m\n",
      "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25hRequirement already satisfied: future in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (0.18.2)\n",
      "Collecting backports.csv (from pattern)\n",
      "  Downloading backports.csv-1.0.7-py2.py3-none-any.whl.metadata (4.0 kB)\n",
      "Collecting mysqlclient (from pattern)\n",
      "  Downloading mysqlclient-2.2.4.tar.gz (90 kB)\n",
      "\u001b[2K     \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m90.4/90.4 kB\u001b[0m \u001b[31m339.8 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m1m362.1 kB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25h  Installing build dependencies ... \u001b[?25ldone\n",
      "\u001b[?25h  Getting requirements to build wheel ... \u001b[?25ldone\n",
      "\u001b[?25h  Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n",
      "\u001b[?25hRequirement already satisfied: beautifulsoup4 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (4.11.1)\n",
      "Requirement already satisfied: lxml in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (4.9.1)\n",
      "Collecting feedparser (from pattern)\n",
      "  Downloading feedparser-6.0.11-py3-none-any.whl.metadata (2.4 kB)\n",
      "Collecting pdfminer.six (from pattern)\n",
      "  Downloading pdfminer.six-20240706-py3-none-any.whl.metadata (4.1 kB)\n",
      "Requirement already satisfied: numpy in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (1.24.3)\n",
      "Requirement already satisfied: scipy in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (1.9.1)\n",
      "Requirement already satisfied: nltk in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (3.8.1)\n",
      "Collecting python-docx (from pattern)\n",
      "  Downloading python_docx-1.1.2-py3-none-any.whl.metadata (2.0 kB)\n",
      "Collecting cherrypy (from pattern)\n",
      "  Downloading CherryPy-18.10.0-py3-none-any.whl.metadata (8.7 kB)\n",
      "Requirement already satisfied: requests in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pattern) (2.28.1)\n",
      "Requirement already satisfied: soupsieve>1.2 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from beautifulsoup4->pattern) (2.3.1)\n",
      "Collecting cheroot>=8.2.1 (from cherrypy->pattern)\n",
      "  Downloading cheroot-10.0.1-py3-none-any.whl.metadata (7.1 kB)\n",
      "Collecting portend>=2.1.1 (from cherrypy->pattern)\n",
      "  Downloading portend-3.2.0-py3-none-any.whl.metadata (3.6 kB)\n",
      "Collecting more-itertools (from cherrypy->pattern)\n",
      "  Downloading more_itertools-10.4.0-py3-none-any.whl.metadata (36 kB)\n",
      "Collecting zc.lockfile (from cherrypy->pattern)\n",
      "  Downloading zc.lockfile-3.0.post1-py3-none-any.whl.metadata (6.2 kB)\n",
      "Collecting jaraco.collections (from cherrypy->pattern)\n",
      "  Downloading jaraco.collections-5.0.1-py3-none-any.whl.metadata (3.8 kB)\n",
      "Collecting sgmllib3k (from feedparser->pattern)\n",
      "  Downloading sgmllib3k-1.0.0.tar.gz (5.8 kB)\n",
      "  Preparing metadata (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25hRequirement already satisfied: click in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from nltk->pattern) (8.0.4)\n",
      "Requirement already satisfied: joblib in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from nltk->pattern) (1.3.2)\n",
      "Requirement already satisfied: regex>=2021.8.3 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from nltk->pattern) (2022.7.9)\n",
      "Requirement already satisfied: tqdm in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from nltk->pattern) (4.64.1)\n",
      "Requirement already satisfied: charset-normalizer>=2.0.0 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pdfminer.six->pattern) (2.0.4)\n",
      "Requirement already satisfied: cryptography>=36.0.0 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from pdfminer.six->pattern) (37.0.1)\n",
      "Collecting typing-extensions>=4.9.0 (from python-docx->pattern)\n",
      "  Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pattern) (3.3)\n",
      "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pattern) (1.26.11)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pattern) (2023.7.22)\n",
      "Collecting jaraco.functools (from cheroot>=8.2.1->cherrypy->pattern)\n",
      "  Downloading jaraco.functools-4.0.2-py3-none-any.whl.metadata (2.8 kB)\n",
      "Requirement already satisfied: cffi>=1.12 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from cryptography>=36.0.0->pdfminer.six->pattern) (1.15.1)\n",
      "Collecting tempora>=1.8 (from portend>=2.1.1->cherrypy->pattern)\n",
      "  Downloading tempora-5.7.0-py3-none-any.whl.metadata (3.2 kB)\n",
      "Collecting jaraco.text (from jaraco.collections->cherrypy->pattern)\n",
      "  Downloading jaraco.text-4.0.0-py3-none-any.whl.metadata (3.7 kB)\n",
      "Requirement already satisfied: setuptools in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from zc.lockfile->cherrypy->pattern) (63.4.1)\n",
      "Requirement already satisfied: pycparser in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=36.0.0->pdfminer.six->pattern) (2.21)\n",
      "Requirement already satisfied: python-dateutil in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from tempora>=1.8->portend>=2.1.1->cherrypy->pattern) (2.8.2)\n",
      "Collecting jaraco.context>=4.1 (from jaraco.text->jaraco.collections->cherrypy->pattern)\n",
      "  Downloading jaraco.context-5.3.0-py3-none-any.whl.metadata (4.0 kB)\n",
      "Collecting autocommand (from jaraco.text->jaraco.collections->cherrypy->pattern)\n",
      "  Downloading autocommand-2.2.2-py3-none-any.whl.metadata (15 kB)\n",
      "Collecting backports.tarfile (from jaraco.context>=4.1->jaraco.text->jaraco.collections->cherrypy->pattern)\n",
      "  Downloading backports.tarfile-1.2.0-py3-none-any.whl.metadata (2.0 kB)\n",
      "Requirement already satisfied: six>=1.5 in /Users/ramtin/anaconda3/envs/py39/lib/python3.9/site-packages (from python-dateutil->tempora>=1.8->portend>=2.1.1->cherrypy->pattern) (1.16.0)\n",
      "Downloading backports.csv-1.0.7-py2.py3-none-any.whl (12 kB)\n",
      "Downloading CherryPy-18.10.0-py3-none-any.whl (349 kB)\n",
      "\u001b[2K   \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m349.8/349.8 kB\u001b[0m \u001b[31m308.8 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m1m336.8 kB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading feedparser-6.0.11-py3-none-any.whl (81 kB)\n",
      "\u001b[2K   \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m81.3/81.3 kB\u001b[0m \u001b[31m352.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m kB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading pdfminer.six-20240706-py3-none-any.whl (5.6 MB)\n",
      "\u001b[2K   \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.6/5.6 MB\u001b[0m \u001b[31m219.0 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mm eta \u001b[36m0:00:01\u001b[0m[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading python_docx-1.1.2-py3-none-any.whl (244 kB)\n",
      "\u001b[2K   \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m244.3/244.3 kB\u001b[0m \u001b[31m220.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m1m216.4 kB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading cheroot-10.0.1-py3-none-any.whl (104 kB)\n",
      "\u001b[2K   \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m104.8/104.8 kB\u001b[0m \u001b[31m185.9 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m kB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m:01\u001b[0m\n",
      "\u001b[?25hDownloading more_itertools-10.4.0-py3-none-any.whl (60 kB)\n",
      "\u001b[2K   \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.9/60.9 kB\u001b[0m \u001b[31m204.1 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m1m177.4 kB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading portend-3.2.0-py3-none-any.whl (5.3 kB)\n",
      "Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)\n",
      "Downloading jaraco.collections-5.0.1-py3-none-any.whl (10 kB)\n",
      "Downloading zc.lockfile-3.0.post1-py3-none-any.whl (9.8 kB)\n",
      "Downloading tempora-5.7.0-py3-none-any.whl (13 kB)\n",
      "Downloading jaraco.functools-4.0.2-py3-none-any.whl (9.9 kB)\n",
      "Downloading jaraco.text-4.0.0-py3-none-any.whl (11 kB)\n",
      "Downloading jaraco.context-5.3.0-py3-none-any.whl (6.5 kB)\n",
      "Downloading autocommand-2.2.2-py3-none-any.whl (19 kB)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading backports.tarfile-1.2.0-py3-none-any.whl (30 kB)\n",
      "Building wheels for collected packages: pattern, mysqlclient, sgmllib3k\n",
      "  Building wheel for pattern (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for pattern: filename=Pattern-3.6-py3-none-any.whl size=22332702 sha256=87d88aa6ebbfcb7d72318a2a3f803172542546b39356f04a9963ee0f84e0b5d9\n",
      "  Stored in directory: /Users/ramtin/Library/Caches/pip/wheels/50/33/f3/ea00b80d50c09f210588bda15ec60bdb38b289b452577cd5c3\n",
      "  Building wheel for mysqlclient (pyproject.toml) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for mysqlclient: filename=mysqlclient-2.2.4-cp39-cp39-macosx_11_0_arm64.whl size=73775 sha256=486b18a9927e86835857d7cd65ca1488f7324577c97c4f1c9d6d8c90b2926cbb\n",
      "  Stored in directory: /Users/ramtin/Library/Caches/pip/wheels/df/23/68/faa07b93488a130b3295ca4e91574e85a9dc4764cd463bc152\n",
      "  Building wheel for sgmllib3k (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for sgmllib3k: filename=sgmllib3k-1.0.0-py3-none-any.whl size=6048 sha256=1143b02b589d8d7c77c44e86a44ce647e51698927b9243e3964e0562e3ef887d\n",
      "  Stored in directory: /Users/ramtin/Library/Caches/pip/wheels/65/7a/a7/78c287f64e401255dff4c13fdbc672fed5efbfd21c530114e1\n",
      "Successfully built pattern mysqlclient sgmllib3k\n",
      "Installing collected packages: sgmllib3k, backports.csv, zc.lockfile, typing-extensions, mysqlclient, more-itertools, feedparser, backports.tarfile, autocommand, python-docx, jaraco.functools, jaraco.context, tempora, pdfminer.six, jaraco.text, cheroot, portend, jaraco.collections, cherrypy, pattern\n",
      "  Attempting uninstall: typing-extensions\n",
      "    Found existing installation: typing_extensions 4.8.0\n",
      "    Uninstalling typing_extensions-4.8.0:\n",
      "      Successfully uninstalled typing_extensions-4.8.0\n",
      "Successfully installed autocommand-2.2.2 backports.csv-1.0.7 backports.tarfile-1.2.0 cheroot-10.0.1 cherrypy-18.10.0 feedparser-6.0.11 jaraco.collections-5.0.1 jaraco.context-5.3.0 jaraco.functools-4.0.2 jaraco.text-4.0.0 more-itertools-10.4.0 mysqlclient-2.2.4 pattern-3.6 pdfminer.six-20240706 portend-3.2.0 python-docx-1.1.2 sgmllib3k-1.0.0 tempora-5.7.0 typing-extensions-4.12.2 zc.lockfile-3.0.post1\n",
      "\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pip install pattern"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "cde34094",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User reviews shape:  (573913, 7)\n"
     ]
    }
   ],
   "source": [
    "df_reviews = pd.read_json('kaggle/input/IMDB_reviews.json', lines=True) \n",
    "print('User reviews shape: ', df_reviews.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "94060a02",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>review_date</th>\n",
       "      <th>movie_id</th>\n",
       "      <th>user_id</th>\n",
       "      <th>is_spoiler</th>\n",
       "      <th>review_text</th>\n",
       "      <th>rating</th>\n",
       "      <th>review_summary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10 February 2006</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1898687</td>\n",
       "      <td>True</td>\n",
       "      <td>In its Oscar year, Shawshank Redemption (writt...</td>\n",
       "      <td>10</td>\n",
       "      <td>A classic piece of unforgettable film-making.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6 September 2000</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur0842118</td>\n",
       "      <td>True</td>\n",
       "      <td>The Shawshank Redemption is without a doubt on...</td>\n",
       "      <td>10</td>\n",
       "      <td>Simply amazing. The best film of the 90's.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3 August 2001</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1285640</td>\n",
       "      <td>True</td>\n",
       "      <td>I believe that this film is the best story eve...</td>\n",
       "      <td>8</td>\n",
       "      <td>The best story ever told on film</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1 September 2002</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1003471</td>\n",
       "      <td>True</td>\n",
       "      <td>**Yes, there are SPOILERS here**This film has ...</td>\n",
       "      <td>10</td>\n",
       "      <td>Busy dying or busy living?</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20 May 2004</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur0226855</td>\n",
       "      <td>True</td>\n",
       "      <td>At the heart of this extraordinary movie is a ...</td>\n",
       "      <td>8</td>\n",
       "      <td>Great story, wondrously told and acted</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        review_date   movie_id    user_id  is_spoiler  \\\n",
       "0  10 February 2006  tt0111161  ur1898687        True   \n",
       "1  6 September 2000  tt0111161  ur0842118        True   \n",
       "2     3 August 2001  tt0111161  ur1285640        True   \n",
       "3  1 September 2002  tt0111161  ur1003471        True   \n",
       "4       20 May 2004  tt0111161  ur0226855        True   \n",
       "\n",
       "                                         review_text  rating  \\\n",
       "0  In its Oscar year, Shawshank Redemption (writt...      10   \n",
       "1  The Shawshank Redemption is without a doubt on...      10   \n",
       "2  I believe that this film is the best story eve...       8   \n",
       "3  **Yes, there are SPOILERS here**This film has ...      10   \n",
       "4  At the heart of this extraordinary movie is a ...       8   \n",
       "\n",
       "                                  review_summary  \n",
       "0  A classic piece of unforgettable film-making.  \n",
       "1     Simply amazing. The best film of the 90's.  \n",
       "2               The best story ever told on film  \n",
       "3                     Busy dying or busy living?  \n",
       "4         Great story, wondrously told and acted  "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_reviews.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "da5a873c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 573913 entries, 0 to 573912\n",
      "Data columns (total 7 columns):\n",
      " #   Column          Non-Null Count   Dtype \n",
      "---  ------          --------------   ----- \n",
      " 0   review_date     573913 non-null  object\n",
      " 1   movie_id        573913 non-null  object\n",
      " 2   user_id         573913 non-null  object\n",
      " 3   is_spoiler      573913 non-null  bool  \n",
      " 4   review_text     573913 non-null  object\n",
      " 5   rating          573913 non-null  int64 \n",
      " 6   review_summary  573913 non-null  object\n",
      "dtypes: bool(1), int64(1), object(5)\n",
      "memory usage: 26.8+ MB\n"
     ]
    }
   ],
   "source": [
    "df_reviews.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "b9fd9dad",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User reviews shape:  (1572, 7)\n"
     ]
    }
   ],
   "source": [
    "df_details = pd.read_json('kaggle/input/IMDB_movie_details.json', lines=True) \n",
    "print('User reviews shape: ', df_details.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "9ea16b9c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>movie_id</th>\n",
       "      <th>plot_summary</th>\n",
       "      <th>duration</th>\n",
       "      <th>genre</th>\n",
       "      <th>rating</th>\n",
       "      <th>release_date</th>\n",
       "      <th>plot_synopsis</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tt0105112</td>\n",
       "      <td>Former CIA analyst, Jack Ryan is in England wi...</td>\n",
       "      <td>1h 57min</td>\n",
       "      <td>[Action, Thriller]</td>\n",
       "      <td>6.9</td>\n",
       "      <td>1992-06-05</td>\n",
       "      <td>Jack Ryan (Ford) is on a \"working vacation\" in...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>tt1204975</td>\n",
       "      <td>Billy (Michael Douglas), Paddy (Robert De Niro...</td>\n",
       "      <td>1h 45min</td>\n",
       "      <td>[Comedy]</td>\n",
       "      <td>6.6</td>\n",
       "      <td>2013-11-01</td>\n",
       "      <td>Four boys around the age of 10 are friends in ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>tt0243655</td>\n",
       "      <td>The setting is Camp Firewood, the year 1981. I...</td>\n",
       "      <td>1h 37min</td>\n",
       "      <td>[Comedy, Romance]</td>\n",
       "      <td>6.7</td>\n",
       "      <td>2002-04-11</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>tt0040897</td>\n",
       "      <td>Fred C. Dobbs and Bob Curtin, both down on the...</td>\n",
       "      <td>2h 6min</td>\n",
       "      <td>[Adventure, Drama, Western]</td>\n",
       "      <td>8.3</td>\n",
       "      <td>1948-01-24</td>\n",
       "      <td>Fred Dobbs (Humphrey Bogart) and Bob Curtin (T...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>tt0126886</td>\n",
       "      <td>Tracy Flick is running unopposed for this year...</td>\n",
       "      <td>1h 43min</td>\n",
       "      <td>[Comedy, Drama, Romance]</td>\n",
       "      <td>7.3</td>\n",
       "      <td>1999-05-07</td>\n",
       "      <td>Jim McAllister (Matthew Broderick) is a much-a...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    movie_id                                       plot_summary  duration  \\\n",
       "0  tt0105112  Former CIA analyst, Jack Ryan is in England wi...  1h 57min   \n",
       "1  tt1204975  Billy (Michael Douglas), Paddy (Robert De Niro...  1h 45min   \n",
       "2  tt0243655  The setting is Camp Firewood, the year 1981. I...  1h 37min   \n",
       "3  tt0040897  Fred C. Dobbs and Bob Curtin, both down on the...   2h 6min   \n",
       "4  tt0126886  Tracy Flick is running unopposed for this year...  1h 43min   \n",
       "\n",
       "                         genre  rating release_date  \\\n",
       "0           [Action, Thriller]     6.9   1992-06-05   \n",
       "1                     [Comedy]     6.6   2013-11-01   \n",
       "2            [Comedy, Romance]     6.7   2002-04-11   \n",
       "3  [Adventure, Drama, Western]     8.3   1948-01-24   \n",
       "4     [Comedy, Drama, Romance]     7.3   1999-05-07   \n",
       "\n",
       "                                       plot_synopsis  \n",
       "0  Jack Ryan (Ford) is on a \"working vacation\" in...  \n",
       "1  Four boys around the age of 10 are friends in ...  \n",
       "2                                                     \n",
       "3  Fred Dobbs (Humphrey Bogart) and Bob Curtin (T...  \n",
       "4  Jim McAllister (Matthew Broderick) is a much-a...  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_details.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "a7591d12",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1572 entries, 0 to 1571\n",
      "Data columns (total 7 columns):\n",
      " #   Column         Non-Null Count  Dtype  \n",
      "---  ------         --------------  -----  \n",
      " 0   movie_id       1572 non-null   object \n",
      " 1   plot_summary   1572 non-null   object \n",
      " 2   duration       1572 non-null   object \n",
      " 3   genre          1572 non-null   object \n",
      " 4   rating         1572 non-null   float64\n",
      " 5   release_date   1572 non-null   object \n",
      " 6   plot_synopsis  1572 non-null   object \n",
      "dtypes: float64(1), object(6)\n",
      "memory usage: 86.1+ KB\n"
     ]
    }
   ],
   "source": [
    "df_details.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "0e45373d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>review_date</th>\n",
       "      <th>movie_id</th>\n",
       "      <th>user_id</th>\n",
       "      <th>is_spoiler</th>\n",
       "      <th>review_text</th>\n",
       "      <th>rating</th>\n",
       "      <th>review_summary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10 February 2006</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1898687</td>\n",
       "      <td>True</td>\n",
       "      <td>In its Oscar year, Shawshank Redemption (writt...</td>\n",
       "      <td>10</td>\n",
       "      <td>A classic piece of unforgettable film-making.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6 September 2000</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur0842118</td>\n",
       "      <td>True</td>\n",
       "      <td>The Shawshank Redemption is without a doubt on...</td>\n",
       "      <td>10</td>\n",
       "      <td>Simply amazing. The best film of the 90's.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3 August 2001</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1285640</td>\n",
       "      <td>True</td>\n",
       "      <td>I believe that this film is the best story eve...</td>\n",
       "      <td>8</td>\n",
       "      <td>The best story ever told on film</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1 September 2002</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1003471</td>\n",
       "      <td>True</td>\n",
       "      <td>**Yes, there are SPOILERS here**This film has ...</td>\n",
       "      <td>10</td>\n",
       "      <td>Busy dying or busy living?</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20 May 2004</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur0226855</td>\n",
       "      <td>True</td>\n",
       "      <td>At the heart of this extraordinary movie is a ...</td>\n",
       "      <td>8</td>\n",
       "      <td>Great story, wondrously told and acted</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        review_date   movie_id    user_id  is_spoiler  \\\n",
       "0  10 February 2006  tt0111161  ur1898687        True   \n",
       "1  6 September 2000  tt0111161  ur0842118        True   \n",
       "2     3 August 2001  tt0111161  ur1285640        True   \n",
       "3  1 September 2002  tt0111161  ur1003471        True   \n",
       "4       20 May 2004  tt0111161  ur0226855        True   \n",
       "\n",
       "                                         review_text  rating  \\\n",
       "0  In its Oscar year, Shawshank Redemption (writt...      10   \n",
       "1  The Shawshank Redemption is without a doubt on...      10   \n",
       "2  I believe that this film is the best story eve...       8   \n",
       "3  **Yes, there are SPOILERS here**This film has ...      10   \n",
       "4  At the heart of this extraordinary movie is a ...       8   \n",
       "\n",
       "                                  review_summary  \n",
       "0  A classic piece of unforgettable film-making.  \n",
       "1     Simply amazing. The best film of the 90's.  \n",
       "2               The best story ever told on film  \n",
       "3                     Busy dying or busy living?  \n",
       "4         Great story, wondrously told and acted  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_analysed_reviews = df_reviews.copy()\n",
    "df_analysed_reviews.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "2c2a0ffe",
   "metadata": {},
   "outputs": [],
   "source": [
    "stop_words = list(set(stopwords.words('english')))\n",
    "len_1 = []\n",
    "for w in word_tokenize(df_reviews.iloc[0][4]):\n",
    "    if len(w) == 1:\n",
    "        len_1.append(w)\n",
    "        \n",
    "for sym in len_1:\n",
    "    stop_words.append(sym)\n",
    "stop_words = set(stop_words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "296ea26b",
   "metadata": {},
   "outputs": [],
   "source": [
    "ps = PorterStemmer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "c494a8a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['cheat', 'die', 'kill']"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bad_words = [\"die\", \"dying\", \"died\", \"kill\", \"killed\", \"killing\", \"cheat\", \"cheating\", \"cheated\"]\n",
    "bad_words = set([ps.stem(w) for w in bad_words])\n",
    "bad_words = list(bad_words)\n",
    "bad_words"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "b69e8e62",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_analysed_reviews[\"bad_flag\"] = [any([y.lower() in bad_words\n",
    "                                    for y in [ps.stem(w) for w in word_tokenize(x[4]) if not w.lower() in stop_words]])\n",
    "                                   for x in df_reviews.values]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "534fee23",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>review_date</th>\n",
       "      <th>movie_id</th>\n",
       "      <th>user_id</th>\n",
       "      <th>is_spoiler</th>\n",
       "      <th>review_text</th>\n",
       "      <th>rating</th>\n",
       "      <th>review_summary</th>\n",
       "      <th>bad_flag</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10 February 2006</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1898687</td>\n",
       "      <td>True</td>\n",
       "      <td>In its Oscar year, Shawshank Redemption (writt...</td>\n",
       "      <td>10</td>\n",
       "      <td>A classic piece of unforgettable film-making.</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6 September 2000</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur0842118</td>\n",
       "      <td>True</td>\n",
       "      <td>The Shawshank Redemption is without a doubt on...</td>\n",
       "      <td>10</td>\n",
       "      <td>Simply amazing. The best film of the 90's.</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3 August 2001</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1285640</td>\n",
       "      <td>True</td>\n",
       "      <td>I believe that this film is the best story eve...</td>\n",
       "      <td>8</td>\n",
       "      <td>The best story ever told on film</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1 September 2002</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur1003471</td>\n",
       "      <td>True</td>\n",
       "      <td>**Yes, there are SPOILERS here**This film has ...</td>\n",
       "      <td>10</td>\n",
       "      <td>Busy dying or busy living?</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20 May 2004</td>\n",
       "      <td>tt0111161</td>\n",
       "      <td>ur0226855</td>\n",
       "      <td>True</td>\n",
       "      <td>At the heart of this extraordinary movie is a ...</td>\n",
       "      <td>8</td>\n",
       "      <td>Great story, wondrously told and acted</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        review_date   movie_id    user_id  is_spoiler  \\\n",
       "0  10 February 2006  tt0111161  ur1898687        True   \n",
       "1  6 September 2000  tt0111161  ur0842118        True   \n",
       "2     3 August 2001  tt0111161  ur1285640        True   \n",
       "3  1 September 2002  tt0111161  ur1003471        True   \n",
       "4       20 May 2004  tt0111161  ur0226855        True   \n",
       "\n",
       "                                         review_text  rating  \\\n",
       "0  In its Oscar year, Shawshank Redemption (writt...      10   \n",
       "1  The Shawshank Redemption is without a doubt on...      10   \n",
       "2  I believe that this film is the best story eve...       8   \n",
       "3  **Yes, there are SPOILERS here**This film has ...      10   \n",
       "4  At the heart of this extraordinary movie is a ...       8   \n",
       "\n",
       "                                  review_summary  bad_flag  \n",
       "0  A classic piece of unforgettable film-making.      True  \n",
       "1     Simply amazing. The best film of the 90's.     False  \n",
       "2               The best story ever told on film      True  \n",
       "3                     Busy dying or busy living?      True  \n",
       "4         Great story, wondrously told and acted     False  "
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_analysed_reviews.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "bcf1a542",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percentage distribution in the dataset of spoilers and not spoilers \n",
      "\n",
      "False    73.7\n",
      "True     26.3\n",
      "Name: is_spoiler, dtype: float64\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAHGCAYAAADUhOmrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bG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JOID4RFWVmZ7rrrLj333HMqLCzUxRdfLOnU5dm0tLQwTwcgWMePH9fYsWP1pS99SS6XK9zjoI/j3S7oU44dO6aoqChdcMEF4R4FQJBiYmL01ltvacyYMeEeBX0cN5yiTxk8eDDhAUSo1NRU7dq1K9xjIALwsguMGTp06Fl/aNwHH3zQy9MACLXc3Fx9//vf17vvvqupU6fqwgsvDNg/efLkME2GvoaXXWBMZWXlWR87Z86cXpwEQCjdc889Kisr05AhQ7rts9lssixLNptNJ06cMD8c+iTiAwBwTqKionT48GG1t7d/6nHcC4IuvOyCsGtvb9dHH30UsBYXFxemaQAEq+vvsMQFzhY3nCIsWltbdf/99ys+Pl4XXXSRhg4dGrABiCxnez8XIHHlA2GSn5+vV155RStXrtQ3v/lNrVixQu+9955++ctfatmyZeEeD0CQLrnkks8MEG4kRxfu+UBYjB49Wk8//bQyMjIUFxennTt36uKLL9ZvfvMbPfPMM/rTn/4U7hEBnKUBAwaorKxMDofjU4/jRnJ04coHwuKDDz5QUlKSpFP3d3T9jejaa6/Vd77znXCOBqAHZs+erfj4+HCPgQjBPR8Ii3Hjxmn//v2SpIkTJ+p3v/udJOnFF1887dv1APRd3O+BYBEfMGrfvn06efKk7r77br3xxhuSpIKCAq1cuVJ2u10PPvigHn744TBPCSAYvHqPYHHPB4zq+n0AXZdn77zzTj3xxBPq6OjQ9u3bNX78eF1++eVhnhIA0JuIDxg1YMAAeb1ef3zExsbqjTfe0Lhx48I8GQDAFF52AQAARhEfMMpms3W7OY2b1QDg/MJbbWGUZVmaO3eu7Ha7JOnYsWOaP39+t0+/XL9+fTjGAwAYQHzAqE/+kqGvf/3rYZoEABAu3HAKAACM4p4PAABgFPEBAACMIj4AAIBRxAcAADCK+AAAAEYRHwAAwCjiAwAAGPV/NR40gIcbGf4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "print('Percentage distribution in the dataset of spoilers and not spoilers \\n')\n",
    "\n",
    "# Compute distribution between classes\n",
    "print(round(df_reviews.is_spoiler.value_counts(normalize=True)*100,2)) \n",
    "# Plot distribution between classes \n",
    "round(df_reviews.is_spoiler.value_counts(normalize=True)*100,2).plot(kind='bar')\n",
    "\n",
    "plt.title('Distributions')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "345b9a57",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'The Shawshank Redemption is without a doubt one of the most brilliant movies I have ever seen. Similar to The Green Mile in many respects (and better than it in almost all of them), these two movies have shown us that Stephen King is a master not only of horror but also of prose that shakes the soul and moves the heart. The plot is average, but King did great things with it in his novella that are only furthered by the direction, and the acting is so top-rate it\\'s almost scary.Tim Robbins plays Andy Dufrane, wrongly imprisoned for 20 years for the murder of his wife. The story focuses on Andy\\'s relationship with \"Red\" Redding (Morgan Freeman, in probably his best role) and his attempts to escape from Shawshank. Bob Gunton is positively evil and frightening as Warden Norton, and there are great performances and cameos all around; the most prominent one being Gil Bellows (late as Billy of Ally McBeal) as Tommy, a fellow inmate of Andy\\'s who suffers under the iron will of Norton.If you haven\\'t seen this movie, GO AND RENT IT NOW. You will not be disappointed. It is positively the best movie of the \\'90\\'s, and one of my Top 3 of all time. This movie is a spectacle to move the mind, soul, and heart. 10/10'"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_analysed_reviews.iloc[1][4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b45e2e8e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.13 64-bit ('py39': conda)",
   "language": "python",
   "name": "python3913jvsc74a57bd0536dd8d7cef9e0a7a3a0f6a92439f3a8950a5c8454fb0f4b78046b15afdc533f"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}