File size: 52,824 Bytes
4d7c011
 
 
 
829f2a2
4d7c011
 
 
829f2a2
 
 
 
 
 
 
 
 
 
 
4d7c011
 
 
829f2a2
4d7c011
 
 
829f2a2
 
 
4d7c011
 
 
829f2a2
 
4d7c011
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
829f2a2
 
 
 
4d7c011
 
 
 
829f2a2
 
4d7c011
 
 
829f2a2
 
 
 
 
4d7c011
 
 
829f2a2
4d7c011
 
 
829f2a2
 
 
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
 
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
829f2a2
4d7c011
829f2a2
 
 
4d7c011
 
 
 
 
 
 
829f2a2
 
 
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
829f2a2
4d7c011
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
829f2a2
 
 
 
4d7c011
 
 
 
 
 
829f2a2
 
 
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
 
 
 
 
 
 
4d7c011
 
 
 
 
 
 
829f2a2
4d7c011
829f2a2
 
 
 
 
4d7c011
829f2a2
 
4d7c011
 
 
 
 
 
 
 
 
829f2a2
 
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
829f2a2
4d7c011
829f2a2
 
 
4d7c011
 
 
 
829f2a2
4d7c011
 
 
829f2a2
 
 
4d7c011
 
 
829f2a2
 
 
 
 
 
4d7c011
 
 
 
829f2a2
4d7c011
 
 
829f2a2
 
4d7c011
 
 
829f2a2
 
 
 
4d7c011
 
 
829f2a2
 
4d7c011
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d7c011
 
 
 
829f2a2
 
4d7c011
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
 
 
 
4d7c011
 
 
 
829f2a2
 
4d7c011
 
 
829f2a2
 
4d7c011
 
 
829f2a2
 
 
 
 
 
 
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
829f2a2
4d7c011
 
 
829f2a2
4d7c011
829f2a2
 
 
 
4d7c011
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d7c011
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
829f2a2
4d7c011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829f2a2
4d7c011
 
829f2a2
4d7c011
829f2a2
4d7c011
 
829f2a2
4d7c011
829f2a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d7c011
 
 
 
 
 
 
829f2a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "iiNbGRn-KitL",
      "metadata": {
        "id": "iiNbGRn-KitL"
      },
      "source": [
        "# Question generation\n",
        "This notebook is inspired by [Question Generation tutorial](https://haystack.deepset.ai/tutorials/question-generation), from Haystack documentation.\n",
        "\n",
        "Here we use a collection of articles about Twin Peaks to generate a variety of questions about that awesome TV series!\n",
        "\n",
        "The following steps are performed:\n",
        "* load data\n",
        "* create document store and write documents\n",
        "* generate questions and save them"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "viixGIJcKPSQ",
      "metadata": {
        "id": "viixGIJcKPSQ"
      },
      "source": [
        "## Preliminary operations"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "id": "MevE4jEZ5QBT",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "MevE4jEZ5QBT",
        "outputId": "136106e4-40c9-4443-ee84-784fb922e188"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Mounted at /content/drive\n"
          ]
        }
      ],
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "VYWRJ-Lf55nV",
      "metadata": {
        "id": "VYWRJ-Lf55nV"
      },
      "outputs": [],
      "source": [
        "# install dependencies\n",
        "! pip install farm-haystack[faiss-gpu]==1.4.0"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "QVDuHAMIK4bg",
      "metadata": {
        "id": "QVDuHAMIK4bg"
      },
      "source": [
        "## Load data"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "id": "72139774",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2022-01-09T08:40:46.176031Z",
          "iopub.status.busy": "2022-01-09T08:40:46.175755Z",
          "iopub.status.idle": "2022-01-09T08:40:46.179554Z",
          "shell.execute_reply": "2022-01-09T08:40:46.178704Z",
          "shell.execute_reply.started": "2022-01-09T08:40:46.175959Z"
        },
        "id": "72139774"
      },
      "outputs": [],
      "source": [
        "import glob\n",
        "import json\n",
        "import os"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "id": "4421e328",
      "metadata": {
        "execution": {
          "iopub.execute_input": "2022-01-09T08:40:47.846999Z",
          "iopub.status.busy": "2022-01-09T08:40:47.846757Z",
          "iopub.status.idle": "2022-01-09T08:40:48.327632Z",
          "shell.execute_reply": "2022-01-09T08:40:48.326829Z",
          "shell.execute_reply.started": "2022-01-09T08:40:47.846975Z"
        },
        "id": "4421e328"
      },
      "outputs": [],
      "source": [
        "DATA_DIRECTORY = '/content/drive/MyDrive/Colab Notebooks/wklp/data'\n",
        "\n",
        "docs=[]\n",
        "\n",
        "for json_file in glob.glob(f'{DATA_DIRECTORY}/*.json'):\n",
        "  # select only the largest documents\n",
        "  if os.path.getsize (json_file)>=5000:\n",
        "    with open(json_file, 'r') as fin: \n",
        "        json_content=json.load(fin)\n",
        "        \n",
        "    doc={'content': json_content['text'],\n",
        "        'meta': {'name': json_content['name'],\n",
        "                 'url': json_content['url']}}\n",
        "    docs.append(doc)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "id": "GR6qWQAn72WG",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "GR6qWQAn72WG",
        "outputId": "1198a602-7f4e-444a-f8f4-05b488663799"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "134"
            ]
          },
          "execution_count": 8,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "len(docs)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "id": "aa231b94",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "execution": {
          "iopub.execute_input": "2022-01-09T08:40:48.796741Z",
          "iopub.status.busy": "2022-01-09T08:40:48.796550Z",
          "iopub.status.idle": "2022-01-09T08:40:48.805224Z",
          "shell.execute_reply": "2022-01-09T08:40:48.804705Z",
          "shell.execute_reply.started": "2022-01-09T08:40:48.796722Z"
        },
        "id": "aa231b94",
        "outputId": "3d88f0a8-635d-419c-8660-f6c77803e369"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{'content': 'Part 5\\nNot to be confused with Episode 5.\\n\"Part 5\" is the fifth episode of the 2017 series of Twin Peaks and the thirty-fifth episode of the franchise as a whole. It aired on June 4, 2017.\\nPlot\\n\"Case files.\"\\n ―Dale Cooper\\nGene and Jake sit in a car, the former on the phone with Lorraine, reporting on the situation with Dougie Jones. Frustrated, she sends the message \"2\" (leaving 159 characters to type) to her contact \"ARGENT\" which causes a device in Buenos Aires to ring and flash twice with its two red lights.\\nConstance Talbot, Detective Macklay, and Detective Harrison observe the John Doe in the morgue. Talbot confirms the decapitation as the man\\'s cause of death and presents a ring found inside the body. On it is an inscription that reads, \"To Dougie, with love, Janey-E.\"\\nCooper\\'s doppelganger sits in his jail cell and correctly predicts that his food is coming. He takes his food and goes to the mirror, noting that BOB is still with him.\\nAt his place of employment, Mike Nelson calls in Steven Burnett, who has applied for a job. Mike tells him that his resume is inadequate and his forms were filled out incorrectly, then kicks him out.\\nSheriff Frank Truman talks to Harry on the phone and is informed by Lucy Brennan that his wife, Doris, is coming to him. Doris tells him about her frustrations, including a leaky pipe.\\nJaney-E, Sonny Jim and Cooper leave the Jones home and Janey-E tells Cooper that he had won $425,000. He looks at Sonny Jim and begins to shed tears. On realization that Dougie\\'s car is not there, Janey-E begrudgingly takes Cooper to Dougie\\'s work.\\nGene and Jake check on Dougie\\'s car again, which still has not moved. A group of delinquent youths also drive by the car.\\nJaney-E drops Cooper off at work and he wanders, following the aim of a statue of a man carrying a revolver. He stands around until Dougie\\'s co-worker, Phil Bisby comes carrying coffee on his way to a board meeting. Following him into the elevator, Cooper takes one of the coffees and begins drinking the \"damn good Joe.\" It was Frank\\'s one who then takes a green tea latte instead while Darren is turned down by Rhonda and Bonnici next to Frank is served the eighth cup carried by Phil.\\nAnthony Sinclair tells Cooper that he has covered for Dougie\\'s absence and during the meeting, as Sinclair presents a report. When saying that there was no arson with Littlefield, Cooper blurts out \"He\\'s lying,\" but does not elaborate, causing the boss Bushnell Mullins to have \"Dougie\" meet with him after the meeting. Mullins questions his accusation and gives him case files to assess by the next day.\\nRodney and Bradley Mitchum come to the Silver Mustang Casino and in front of Candie, Mandie and Sandie punish Burns for Cooper\\'s win at the casino and replace Burns with Warrick, who they tell to inform them if Cooper ever returns to the casino.\\nWhile his mother is passed out on drugs, the little boy living in the home across from Dougie\\'s car goes to examine it. He is shooed away by the gang of youths, arriving in a loud black 1970 Dodge Charger, who try to steal the car. The bomb under Dougie\\'s car explodes, killing several members of the gang, and the boy runs back to his home. Hearing him coming back in, his mother slowly wakes up and stares at the door.\\nAn auto detailer informs Jade that he found a set of keys for the Great Northern Hotel in her car. Since they have an address on them, she puts them inside a mailbox for delivery.\\nNorma sorts through documents as Heidi is serving and Becky delivers bread to Toad and gets money from Shelly. Norma goes to Shelly, urging her to help Becky rather than continue to enable her. Becky takes the money to Steven and they snort a drug.\\nCooper is pushed out of the elevator at the end of the workday and he goes to the statue he saw that morning.\\nAt the Twin Peaks sheriff\\'s station, Hawk and Andy continue to sort through files.\\nJacoby starts up his webcast he hosts as \"Dr. Amp\" and it is viewed by Jerry Horne—who smokes a joint—and Nadine Hurley. His broadcast ends with an advertisement for his golden shovels that he urges his viewers to buy to shovel themselves \"out of the shit and into the truth.\"\\nAt the Pentagon, Lieutenant Cynthia Knox informs Colonel Davis that they have received a match on Major Garland Briggs\\' fingerprints – the sixteenth match in 25 years – in Buckhorn, South Dakota. Davis doubts the legitimacy of the match but says that if it is indeed truly Briggs that has been identified, that the FBI must be informed.\\nThe band Trouble plays at the Roadhouse as Richard Horne smokes underneath a \\'no smoking\\' sign. Employee Federico asks him to quit and the off-duty Deputy Chad Broxford takes over but ends up taking a bribe from Horne. Charlotte, from the next table over with Elizabeth, asks him for a light, but he grabs her and threatens to rape her.\\nAgent Preston examines Cooper\\'s file and compares his fingerprints from before his 1989 disappearance and from the doppelganger\\'s booking at the federal prison.\\nWarden Murphy gives the doppelganger his phone call. However, the doppelganger dials a number that sets off the prison\\'s alarms and he says \"The cow jumped over the moon,\" before hanging up, stopping the alarms.\\nIn Buenos Aires, the device contacted before by Lorraine rings and flashes twice with its two red lights and then shrinks to a kind of seed.\\nCooper continues to observe the statue.\\nCredits\\n\\nStarring\\nKyle MacLachlan as Dale Cooper / Dale Cooper (doppelganger)\\nIn Alphabetical Order\\nJane Adams as Constance Talbot\\nMädchen Amick as Shelly\\nTammie Baird as Lorraine\\nChrysta Bell as FBI Agent Tammy Preston\\nJim Belushi as Bradley Mitchum\\nSean Bolger as Detailer\\nBrent Briscoe as Detective Dave Macklay\\nWes Brown as Darren\\nJuan Carlos Cantu as Officer Reynaldo\\nVincent Castellanos as Federico\\nBailey Chase as Detective Don Harrison\\nCandy Clark as Doris Truman\\nGrace Victoria Cox as Charlotte\\nGiselle Damier as Sandie\\nDavid Dastmalchian as Pit Boss Warrick\\nJosh Fadem as Phil Bisby\\nEamon Farren as Richard Horne\\nRobert Forster as Sheriff Frank Truman\\nPierce Gagnon as Sonny Jim Jones\\nHailey Gates as Drugged-out Mother\\nBrett Gelman as Supervisor Burns\\nHarry Goaz as Deputy Andy Brennan\\nHank Harris as Prison Tech\\nAndrea Hays as Heidi\\nGary Hershberger as Mike Nelson\\nMichael Horse as Deputy Chief Tommy \"Hawk\" Hill\\nErnie Hudson as Colonel Davis\\nCaleb Landry Jones as Steven Burnett\\nDavid Patrick Kelly as Jerry Horne\\nRobert Knepper as Rodney Mitchum\\nAndrea Leal as Mandie\\nSheryl Lee as Laura Palmer\\nJane Levy as Elizabeth\\nPeggy Lipton as Norma Jennings\\nKarl Makinen as Inspector Randy Hollister\\nJames Morrison as Warden Dwight Murphy\\nDon Murray as Bushnell Mullins\\nJohn Pirruccello as Deputy Chad Broxford\\nAdele René as Lieutenant Cynthia Cox\\nKimmy Robertson as Lucy Brennan\\nWendy Robie as Nadine Hurley\\nMarv Rosand as Toad\\nElena Satine as Rhonda\\nAmanda Seyfried as Rebecca (Becky) Burnett\\nAmie Shiels as Candie\\nSawyer Shipman as Little Boy\\nFrank Silva as Bob\\nTom Sizemore as Anthony Sinclair\\nBob Stephenson as Frank\\nRuss Tamblyn as Dr. Lawrence Jacoby\\nBill Tangradi as Jake\\nGreg Vrotsos as Gene\\nNaomi Watts as Janey-E Jones\\nNafessa Williams as Jade\\nBlake Zingale as Punk Leader\\nTrouble:\\nRiley Lynch\\nSam Smith\\nAlex Zhang Hungtai\\nDean Hurley\\nUncredited\\nTyler Malik as stand-in\\nKenneth Welsh as Windom Earle (archive footage)\\nUnknown performer as Bonnici\\nUnknown performer as Woman in elevator\\nUnknown performer as Man across Mullins\\nUnknown performer as Woman at meeting\\nUnknown performer as Mullins\\' secretary\\nProduction staff\\nSee: Twin Peaks (2017) § Production staff\\nFeatured music\\n\"The Flame\"\\nWritten and performed by Johnny Jewel\\nCourtesy of Italians Do It Better\\n\"Frank 2000\"\\nWritten by Angelo Badalamenti and David Lynch\\nPerformed by Thought Gang\\n\"I Love How You Love Me\"\\nWritten by Barry Mann and Larry Kolber\\nPerformed by The Paris Sisters\\nPublished by Screen Gems-EMI Music Inc. (BMI)\\n\"I Am\"\\nWritten and performed by BluntedBeatz\\n\"Stars And Stripes Forever\"\\nWritten by John Philip Sousa\\nPerformed and arranged by the U.S. Army Band\\n\"Snake Eyes\"\\nWritten by Dean Hurley, Riley Lynch and Alex Zhang Hungtai\\nPerformed by Trouble\\n\"Habit\" and \"Tabloid\"\\nWritten and performed by Uniform\\nCourtesy of Sacred Bones Records\\n\"Windswept\"\\nWritten and performed by Johnny Jewel\\nCourtesy of Italians Do It Better\\nNotes\\nThis episode was dedicated to the memory of Marv Rosand.\\nAmy Shiels is credited as \"Amie\".\\nFrank, Dougie\\'s coworker who discovers he likes green tea lattes, is played by Bob Stephenson, who appeared in Episode 6 as the burger cook at the Double R Diner. This was Stephenson\\'s first acting gig.\\nUpon release, Twin Peaks: The Return earned some criticism for earning the \"Empty Cup Award,\" a satirical achievement for television series where actors handle coffee cups that are claimed to be full in the dialogue but are very clearly empty based on how they are handled by the performers. In the case of this episode, however, Kyle MacLachlan was given some praise for being the sole actor to handle his cup as though it were actually full, especially in an episode where a character (Phil Bisby) unrealistically balances two full trays of coffee while running around.\\nThe statue in front of Dougie\\'s workplace was not originally part of location and was brought by the production staff. It might be a statue of Donald Lynch, father of David Lynch, since according to the stand-in Tyler Malkin, Lynch talked to it saying \"Hi, Dad\".\\nThe numbers input by the doppelganger during his phone call are, using the standard DTMF tones pitched up 2 octaves for offscreen ones:\\n16 (pause) 1235789 (computer modem response) 3135378912315 (01189998819991197253 offscreen)\\nThis could be interpreted as two numbers dialing to get an outside line from the internal prison phone system, then a 7 digit local number calling a computer set up beforehand with a local number so it would be a free local call and finally a code that triggers a pre-planned, automated hack of the prison systems.',\n",
              " 'meta': {'name': 'Part_5', 'url': 'https://twinpeaks.fandom.com/wiki/Part_5'}}"
            ]
          },
          "execution_count": 9,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "docs[5]"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "Yu3bAUPoLrPI",
      "metadata": {
        "id": "Yu3bAUPoLrPI"
      },
      "source": [
        "## Create document store ([FAISS](https://github.com/facebookresearch/faiss)) and write documents\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "id": "bfe846df",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "execution": {
          "iopub.execute_input": "2022-01-09T08:40:59.678181Z",
          "iopub.status.busy": "2022-01-09T08:40:59.678003Z",
          "iopub.status.idle": "2022-01-09T08:40:59.753228Z",
          "shell.execute_reply": "2022-01-09T08:40:59.752500Z",
          "shell.execute_reply.started": "2022-01-09T08:40:59.678161Z"
        },
        "id": "bfe846df",
        "outputId": "be9c9ef8-bcc4-4c4a-e7a5-9003077a7ea3"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "INFO - haystack.modeling.model.optimization -  apex not found, won't use it. See https://nvidia.github.io/apex/\n",
            "ERROR - root -  Failed to import 'magic' (from 'python-magic' and 'python-magic-bin' on Windows). FileTypeClassifier will not perform mimetype detection on extensionless files. Please make sure the necessary OS libraries are installed if you need this functionality.\n",
            "INFO - haystack.telemetry -  Haystack sends anonymous usage data to understand the actual usage and steer dev efforts towards features that are most meaningful to users. You can opt-out at anytime by calling disable_telemetry() or by manually setting the environment variable HAYSTACK_TELEMETRY_ENABLED as described for different operating systems on the documentation page. More information at https://haystack.deepset.ai/guides/telemetry\n"
          ]
        }
      ],
      "source": [
        "from haystack.document_stores import FAISSDocumentStore\n",
        "\n",
        "# the document store settings are those compatible with Embedding Retriever\n",
        "document_store = FAISSDocumentStore(\n",
        "    similarity=\"dot_product\",\n",
        "    embedding_dim=768)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "id": "191144b4",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 49,
          "referenced_widgets": [
            "81c8d8eb80d64687bdcc31ab1e3f156e",
            "b18ba72ca8e94c508fde617b04b82273",
            "0cc8731e80994ab097236f295da512c7",
            "e1b08799bca14b7aa8aed017b5545923",
            "4ee263ae48834c5dbb138a5dbe2183bd",
            "ae4e66819ab04f68a867768d03bc4a04",
            "6bba9b7051f64993a477688eb8c6ed92",
            "96e28522b93b4c77a9d6da982d601465",
            "9eb3c190c28b47618572ecd9e3b80932",
            "887b5bcc8d1e4c38b40700d324424f33",
            "3739785a410b4eadb0c36881e41b88ed"
          ]
        },
        "execution": {
          "iopub.execute_input": "2022-01-09T08:41:10.695292Z",
          "iopub.status.busy": "2022-01-09T08:41:10.695064Z",
          "iopub.status.idle": "2022-01-09T08:41:22.144864Z",
          "shell.execute_reply": "2022-01-09T08:41:22.144203Z",
          "shell.execute_reply.started": "2022-01-09T08:41:10.695271Z"
        },
        "id": "191144b4",
        "outputId": "f564e88e-be20-4f20-b4ed-4c663bfd71ac"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "81c8d8eb80d64687bdcc31ab1e3f156e",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "Writing Documents:   0%|          | 0/134 [00:00<?, ?it/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "# write documents\n",
        "document_store.write_documents(docs)\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "id": "fCVArUtw1rV5",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "fCVArUtw1rV5",
        "outputId": "852fc261-c684-4f65-d17f-011f2b1860d0"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "134"
            ]
          },
          "execution_count": 23,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "len(document_store.get_all_documents())"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "oPOm5UsJxG37",
      "metadata": {
        "id": "oPOm5UsJxG37"
      },
      "source": [
        "## Generate questions and save them"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "id": "dYf2rgwzxa1z",
      "metadata": {
        "id": "dYf2rgwzxa1z"
      },
      "outputs": [],
      "source": [
        "from haystack.nodes import QuestionGenerator\n",
        "from haystack.pipelines import QuestionGenerationPipeline\n",
        "from haystack.utils import launch_es, print_questions\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "id": "EnQk6d0FzlnT",
      "metadata": {
        "id": "EnQk6d0FzlnT"
      },
      "outputs": [],
      "source": [
        "OUTPUT_QUESTIONS_FILE='/content/drive/MyDrive/Colab Notebooks/wklp/questions.txt'"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "id": "8fYMVd_ggJnw",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8fYMVd_ggJnw",
        "outputId": "880c4204-854c-49fc-f82b-ec008076b662"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "INFO - haystack.modeling.utils -  Using devices: CUDA\n",
            "INFO - haystack.modeling.utils -  Number of GPUs: 1\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "0.0\n",
            "3.731343283582089\n",
            "7.462686567164178\n",
            "11.194029850746269\n",
            "14.925373134328357\n",
            "18.65671641791045\n",
            "22.388059701492537\n",
            "26.119402985074625\n",
            "29.850746268656714\n",
            "33.582089552238806\n",
            "37.3134328358209\n",
            "41.04477611940299\n",
            "44.776119402985074\n",
            "48.507462686567166\n",
            "52.23880597014925\n",
            "55.970149253731336\n",
            "59.70149253731343\n",
            "63.43283582089553\n",
            "67.16417910447761\n",
            "70.8955223880597\n",
            "74.6268656716418\n",
            "78.35820895522389\n",
            "82.08955223880598\n",
            "85.82089552238806\n",
            "89.55223880597015\n"
          ]
        }
      ],
      "source": [
        "# Initialize Question Generator\n",
        "question_generator = QuestionGenerator()\n",
        "\n",
        "question_generation_pipeline = QuestionGenerationPipeline(question_generator)\n",
        "for idx, document in enumerate(document_store):\n",
        "    if idx%5==0:\n",
        "      print(idx/len(docs)*100)\n",
        "    results = question_generation_pipeline.run(documents=[document])\n",
        "\n",
        "    # save to file\n",
        "    questions_for_doc=f'{idx}: {document.content[:100]}...\\n'+'-'*15+'\\n'\n",
        "    if \"generated_questions\" in results.keys():\n",
        "      for result in results[\"generated_questions\"]:\n",
        "          for question in result[\"questions\"]:\n",
        "              questions_for_doc+=(f\" - {question}\\n\")\n",
        "    with open(OUTPUT_QUESTIONS_FILE,'a+') as fo:\n",
        "      fo.write(questions_for_doc)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 30,
      "id": "1i2C6PhSKHZY",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "1i2C6PhSKHZY",
        "outputId": "ba202bf9-b445-43ca-c267-7fd873a80e81"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "124: Jerry Horne\n",
            "Jeremy \"Jerry\" Horne was the playboy brother of Benjamin Horne and the uncle of Audrey a...\n",
            "---------------\n",
            " -  Who was the playboy brother of Benjamin Horne?\n",
            " -  What was Jerry Horne's uncle's name?\n",
            " -  Who did Jerry watch in his childhood?\n",
            " -  Who did Jerry watch dance with with a flashlight?\n",
            " -  Who was the place kicker in the starting lineup of Twin Peaks High School football team of 1968?\n",
            " -  Who was a member of the Bookhouse Boys?\n",
            " -  When did Big Ed graduate from Gonzaga University?\n",
            " -  Who graduated last in his class at Gonzaga in 1974?\n",
            " -  What year did Jerry begin working with his brother to find business partners for the Ghostwood Development Project?\n",
            " -  What state had Jerry's license to practice law revoked?\n",
            " -  Who was the owner of the Canadian brothel and casino?\n",
            " -  When did Jerry come to the Great Northern Hotel after a trip to Paris?\n",
            " -  What did Jerry bring to Ben?\n",
            " -  Who brought a sandwich for Ben?\n",
            " -  Who told Ben about the murder of Laura Palmer?\n",
            " -  What was the name of the Norwegians who were set to sign the Ghostwood deal?\n",
            " -  What was the name of the brothel's madame?\n",
            " -  Who brought out the drinks at One Eyed Jacks?\n",
            " -  What was one of the brothers first in line?\n",
            " -  Who was the brothel's madame?\n",
            " -  Who brought out the girls?\n",
            " -  What did Jerry lose for Blackie O'Reilly?\n",
            " -  When did Jerry arrive at the Great Northern?\n",
            " -  Who did Jerry tell his brother about?\n",
            " -  What Icelandic woman did Jerry fall for?\n",
            " -  Who did Ben propose to have the visitors sign the deal with?\n",
            " -  What did Jerry do when he broke down crying?\n",
            " -  Where did Jerry go after Jerry broke down?\n",
            " -  What caused Jerry to close the office doors when he broke down crying?\n",
            " -  Who did Jerry woo at a party held for the businessmen at the Great Northern?\n",
            " -  What caused Leland to have a misunderstanding?\n",
            " -  What caused Leland to have a breakdown?\n",
            " -  Jerry went to his brother, who said, \"get Doctor Jacoby, a net, and get out of my life\"?\n",
            " -  What was Ben's only beverage?\n",
            " -  What did Ben have in his mug of beer?\n",
            " -  Who was asked to dismiss them to the dining room?\n",
            " -  What was the name of the restaurant Jerry wanted to go to?\n",
            " -  What did Jerry do to Blackie?\n",
            " -  How did Jerry react to the question about Ben?\n",
            " -  What was Jerry's reaction to Jerry leaving her?\n",
            " -  What did Jerry say she used to be?\n",
            " -  Where did Jerry go to find Ben?\n",
            " -  Who did Jerry leave her with?\n",
            " -  Where did Ben and Leland Palmer discuss Catherine Martell's whereabouts?\n",
            " -  What was Leo Johnson's medical condition?\n",
            " -  What song did Hank Jennings dance with?\n",
            " -  What did Leland say he was back and ready for?\n",
            " -  Who left the night after Josie Packard left?\n",
            " -  Hank Jennings waited for Josie Packard to leave the night before?\n",
            " -  Jerry took issue with Leo apparently chopping wood inside what house?\n",
            " -  Hank noted the probability that what was dead in the wreckage of the mill?\n",
            " -  Who sat with Jerry the next day?\n",
            " -  Who sat with Jerry in front of the two ledgers for the Packard Sawmill?\n",
            " -  What did Jerry go to Ben's office with an insurance policy for the mill?\n",
            " -  Who signed the insurance policy?\n",
            " -  Who signed an insurance policy for the mill?\n",
            " -  Who did Ben have him call the Icelanders as Leland entered?\n",
            " -  What did Einar Thorson say about the fire?\n",
            " -  Who said that Leland called him about the fire?\n",
            " -  What did Ben say to Jerry?\n",
            " -  How long after Jerry's death did he go to the police?\n",
            " -  Who did Jerry ask to kill?\n",
            " -  What was Jerry's brother in custody for?\n",
            " -  Who was Leland responsible for murdering?\n",
            " -  Who did Ben say he was with the night Laura was killed?\n",
            " -  What did Ben and Catherine reminisce about when they were boys?\n",
            " -  Who was the FBI Special Agent that Ben was questioned by?\n",
            " -  Who were the FBI Special Agents questioned by?\n",
            " -  Who was the Sheriff?\n",
            " -  What was Jerry's brother's background in law?\n",
            " -  What did Laura's diary make about Ben?\n",
            " -  Who granted Jerry's request to be left alone with Ben for a moment?\n",
            " -  Jerry reprimanded Ben for what outburst?\n",
            " -  What was the name of the one-armed man brought before Benjamin?\n",
            " -  What did Jerry order Truman to do?\n",
            " -  How long had Ben been held?\n",
            " -  Who charged Ben with Laura's murder?\n",
            " -  What did Ben try to do to the sheriff but Jerry restrained him?\n",
            " -  When was Ben released?\n",
            " -  Who lost the Ghostwood Development Plan to Catherine Martell?\n",
            " -  Who brought Jerry to Ben's office?\n",
            " -  What did Ben believe Jerry to be?\n",
            " -  Who believed Ben to be Jeb Stuart?\n",
            " -  What did Jacoby believe did not help his mental state?\n",
            " -  Who did Jerry tell Audrey that Ben was fun in?\n",
            " -  What role did Ben play in Ben's Civil War?\n",
            " -  Who was General Grant?\n",
            " -  What did Ben do to Audrey?\n",
            " -  What was Ben's plan to preserve?\n",
            " -  Who was a potential business partner for Stop Ghostwood Jerry?\n",
            " -  What was the name of the bird that Ben presented to stop ghostwood Jerry to save?\n",
            " -  What did Jerry trade for cannabis?\n",
            " -  What was Jerry's brother's name?\n",
            " -  Who did Jerry interrupt while meeting with Beverly Paige?\n",
            " -  What did Ben reprimand Jerry for?\n",
            " -  Who asked if Jerry was wearing their mother's hat?\n",
            " -  What was Jerry's mother's hat?\n",
            " -  What was Dr. Jacoby's webcast known as?\n",
            " -  When did Jerry become lost in the woods?\n",
            " -  Who did Jerry talk to while high?\n",
            " -  What did Jerry try to do with his foot?\n",
            " -  How did Jerry get phone service?\n",
            " -  What was Jerry's great-nephew's name?\n",
            " -  What did Jerry blame for the disintegration of his binoculars?\n",
            " -  Jerry saw Cooper's doppelganger investigate what?\n",
            " -  What was Jerry's fault?\n",
            " -  Where was Jerry taken into custody by the police?\n",
            " -  Who played Jerry behind the scenes?\n",
            " -  What actor reprised the role in the 2017 revival?\n",
            "\n",
            "\n",
            "Generated questions:\n",
            " -  Who was the playboy brother of Benjamin Horne?\n",
            " -  What was Jerry Horne's uncle's name?\n",
            " -  Who did Jerry watch in his childhood?\n",
            " -  Who did Jerry watch dance with with a flashlight?\n",
            " -  Who was the place kicker in the starting lineup of Twin Peaks High School football team of 1968?\n",
            " -  Who was a member of the Bookhouse Boys?\n",
            " -  When did Big Ed graduate from Gonzaga University?\n",
            " -  Who graduated last in his class at Gonzaga in 1974?\n",
            " -  What year did Jerry begin working with his brother to find business partners for the Ghostwood Development Project?\n",
            " -  What state had Jerry's license to practice law revoked?\n",
            " -  Who was the owner of the Canadian brothel and casino?\n",
            " -  When did Jerry come to the Great Northern Hotel after a trip to Paris?\n",
            " -  What did Jerry bring to Ben?\n",
            " -  Who brought a sandwich for Ben?\n",
            " -  Who told Ben about the murder of Laura Palmer?\n",
            " -  What was the name of the Norwegians who were set to sign the Ghostwood deal?\n",
            " -  What was the name of the brothel's madame?\n",
            " -  Who brought out the drinks at One Eyed Jacks?\n",
            " -  What was one of the brothers first in line?\n",
            " -  Who was the brothel's madame?\n",
            " -  Who brought out the girls?\n",
            " -  What did Jerry lose for Blackie O'Reilly?\n",
            " -  When did Jerry arrive at the Great Northern?\n",
            " -  Who did Jerry tell his brother about?\n",
            " -  What Icelandic woman did Jerry fall for?\n",
            " -  Who did Ben propose to have the visitors sign the deal with?\n",
            " -  What did Jerry do when he broke down crying?\n",
            " -  Where did Jerry go after Jerry broke down?\n",
            " -  What caused Jerry to close the office doors when he broke down crying?\n",
            " -  Who did Jerry woo at a party held for the businessmen at the Great Northern?\n",
            " -  What caused Leland to have a misunderstanding?\n",
            " -  What caused Leland to have a breakdown?\n",
            " -  Jerry went to his brother, who said, \"get Doctor Jacoby, a net, and get out of my life\"?\n",
            " -  What was Ben's only beverage?\n",
            " -  What did Ben have in his mug of beer?\n",
            " -  Who was asked to dismiss them to the dining room?\n",
            " -  What was the name of the restaurant Jerry wanted to go to?\n",
            " -  What did Jerry do to Blackie?\n",
            " -  How did Jerry react to the question about Ben?\n",
            " -  What was Jerry's reaction to Jerry leaving her?\n",
            " -  What did Jerry say she used to be?\n",
            " -  Where did Jerry go to find Ben?\n",
            " -  Who did Jerry leave her with?\n",
            " -  Where did Ben and Leland Palmer discuss Catherine Martell's whereabouts?\n",
            " -  What was Leo Johnson's medical condition?\n",
            " -  What song did Hank Jennings dance with?\n",
            " -  What did Leland say he was back and ready for?\n",
            " -  Who left the night after Josie Packard left?\n",
            " -  Hank Jennings waited for Josie Packard to leave the night before?\n",
            " -  Jerry took issue with Leo apparently chopping wood inside what house?\n",
            " -  Hank noted the probability that what was dead in the wreckage of the mill?\n",
            " -  Who sat with Jerry the next day?\n",
            " -  Who sat with Jerry in front of the two ledgers for the Packard Sawmill?\n",
            " -  What did Jerry go to Ben's office with an insurance policy for the mill?\n",
            " -  Who signed the insurance policy?\n",
            " -  Who signed an insurance policy for the mill?\n",
            " -  Who did Ben have him call the Icelanders as Leland entered?\n",
            " -  What did Einar Thorson say about the fire?\n",
            " -  Who said that Leland called him about the fire?\n",
            " -  What did Ben say to Jerry?\n",
            " -  How long after Jerry's death did he go to the police?\n",
            " -  Who did Jerry ask to kill?\n",
            " -  What was Jerry's brother in custody for?\n",
            " -  Who was Leland responsible for murdering?\n",
            " -  Who did Ben say he was with the night Laura was killed?\n",
            " -  What did Ben and Catherine reminisce about when they were boys?\n",
            " -  Who was the FBI Special Agent that Ben was questioned by?\n",
            " -  Who were the FBI Special Agents questioned by?\n",
            " -  Who was the Sheriff?\n",
            " -  What was Jerry's brother's background in law?\n",
            " -  What did Laura's diary make about Ben?\n",
            " -  Who granted Jerry's request to be left alone with Ben for a moment?\n",
            " -  Jerry reprimanded Ben for what outburst?\n",
            " -  What was the name of the one-armed man brought before Benjamin?\n",
            " -  What did Jerry order Truman to do?\n",
            " -  How long had Ben been held?\n",
            " -  Who charged Ben with Laura's murder?\n",
            " -  What did Ben try to do to the sheriff but Jerry restrained him?\n",
            " -  When was Ben released?\n",
            " -  Who lost the Ghostwood Development Plan to Catherine Martell?\n",
            " -  Who brought Jerry to Ben's office?\n",
            " -  What did Ben believe Jerry to be?\n",
            " -  Who believed Ben to be Jeb Stuart?\n",
            " -  What did Jacoby believe did not help his mental state?\n",
            " -  Who did Jerry tell Audrey that Ben was fun in?\n",
            " -  What role did Ben play in Ben's Civil War?\n",
            " -  Who was General Grant?\n",
            " -  What did Ben do to Audrey?\n",
            " -  What was Ben's plan to preserve?\n",
            " -  Who was a potential business partner for Stop Ghostwood Jerry?\n",
            " -  What was the name of the bird that Ben presented to stop ghostwood Jerry to save?\n",
            " -  What did Jerry trade for cannabis?\n",
            " -  What was Jerry's brother's name?\n",
            " -  Who did Jerry interrupt while meeting with Beverly Paige?\n",
            " -  What did Ben reprimand Jerry for?\n",
            " -  Who asked if Jerry was wearing their mother's hat?\n",
            " -  What was Jerry's mother's hat?\n",
            " -  What was Dr. Jacoby's webcast known as?\n",
            " -  When did Jerry become lost in the woods?\n",
            " -  Who did Jerry talk to while high?\n",
            " -  What did Jerry try to do with his foot?\n",
            " -  How did Jerry get phone service?\n",
            " -  What was Jerry's great-nephew's name?\n",
            " -  What did Jerry blame for the disintegration of his binoculars?\n",
            " -  Jerry saw Cooper's doppelganger investigate what?\n",
            " -  What was Jerry's fault?\n",
            " -  Where was Jerry taken into custody by the police?\n",
            " -  Who played Jerry behind the scenes?\n",
            " -  What actor reprised the role in the 2017 revival?\n"
          ]
        }
      ],
      "source": [
        "print(questions_for_doc)\n",
        "print_questions(results)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "QN9xxnTrKLTX",
      "metadata": {
        "id": "QN9xxnTrKLTX"
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "collapsed_sections": [],
      "name": "question_generation.ipynb",
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "display_name": "saturn (Python 3)",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.9.5"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "0cc8731e80994ab097236f295da512c7": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_96e28522b93b4c77a9d6da982d601465",
            "max": 134,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_9eb3c190c28b47618572ecd9e3b80932",
            "value": 134
          }
        },
        "3739785a410b4eadb0c36881e41b88ed": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "4ee263ae48834c5dbb138a5dbe2183bd": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "6bba9b7051f64993a477688eb8c6ed92": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "81c8d8eb80d64687bdcc31ab1e3f156e": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_b18ba72ca8e94c508fde617b04b82273",
              "IPY_MODEL_0cc8731e80994ab097236f295da512c7",
              "IPY_MODEL_e1b08799bca14b7aa8aed017b5545923"
            ],
            "layout": "IPY_MODEL_4ee263ae48834c5dbb138a5dbe2183bd"
          }
        },
        "887b5bcc8d1e4c38b40700d324424f33": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "96e28522b93b4c77a9d6da982d601465": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9eb3c190c28b47618572ecd9e3b80932": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "ae4e66819ab04f68a867768d03bc4a04": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "b18ba72ca8e94c508fde617b04b82273": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_ae4e66819ab04f68a867768d03bc4a04",
            "placeholder": "​",
            "style": "IPY_MODEL_6bba9b7051f64993a477688eb8c6ed92",
            "value": "Writing Documents: "
          }
        },
        "e1b08799bca14b7aa8aed017b5545923": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_887b5bcc8d1e4c38b40700d324424f33",
            "placeholder": "​",
            "style": "IPY_MODEL_3739785a410b4eadb0c36881e41b88ed",
            "value": " 10000/? [00:00&lt;00:00, 14955.47it/s]"
          }
        }
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}