File size: 50,670 Bytes
9d50a00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Repo card metadata block was not found. Setting CardData to empty.\n"
     ]
    }
   ],
   "source": [
    "from datasets import load_dataset\n",
    "dataset1 = load_dataset(\"nbertagnolli/counsel-chat\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatasetDict({\n",
       "    train: Dataset({\n",
       "        features: ['questionID', 'questionTitle', 'questionText', 'questionLink', 'topic', 'therapistInfo', 'therapistURL', 'answerText', 'upvotes', 'views'],\n",
       "        num_rows: 2775\n",
       "    })\n",
       "})"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "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>questionID</th>\n",
       "      <th>questionTitle</th>\n",
       "      <th>questionText</th>\n",
       "      <th>questionLink</th>\n",
       "      <th>topic</th>\n",
       "      <th>therapistInfo</th>\n",
       "      <th>therapistURL</th>\n",
       "      <th>answerText</th>\n",
       "      <th>upvotes</th>\n",
       "      <th>views</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>Do I have too many issues for counseling?</td>\n",
       "      <td>I have so many issues to address. I have a his...</td>\n",
       "      <td>https://counselchat.com/questions/do-i-have-to...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Jennifer MolinariHypnotherapist &amp; Licensed Cou...</td>\n",
       "      <td>https://counselchat.com/therapists/jennifer-mo...</td>\n",
       "      <td>It is very common for people to have multiple ...</td>\n",
       "      <td>3</td>\n",
       "      <td>1971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>Do I have too many issues for counseling?</td>\n",
       "      <td>I have so many issues to address. I have a his...</td>\n",
       "      <td>https://counselchat.com/questions/do-i-have-to...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Jason Lynch, MS, LMHC, LCAC, ADSIndividual &amp; C...</td>\n",
       "      <td>https://counselchat.com/therapists/jason-lynch...</td>\n",
       "      <td>I've never heard of someone having \"too many i...</td>\n",
       "      <td>2</td>\n",
       "      <td>386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>Do I have too many issues for counseling?</td>\n",
       "      <td>I have so many issues to address. I have a his...</td>\n",
       "      <td>https://counselchat.com/questions/do-i-have-to...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Shakeeta TorresFaith Based Mental Health Couns...</td>\n",
       "      <td>https://counselchat.com/therapists/shakeeta-to...</td>\n",
       "      <td>Absolutely not.  I strongly recommending worki...</td>\n",
       "      <td>2</td>\n",
       "      <td>3071</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>Do I have too many issues for counseling?</td>\n",
       "      <td>I have so many issues to address. I have a his...</td>\n",
       "      <td>https://counselchat.com/questions/do-i-have-to...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Noorayne ChevalierMA, RP, CCC, CCAC, LLP (Mich...</td>\n",
       "      <td>https://counselchat.com/therapists/noorayne-ch...</td>\n",
       "      <td>Let me start by saying there are never too man...</td>\n",
       "      <td>2</td>\n",
       "      <td>2643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>Do I have too many issues for counseling?</td>\n",
       "      <td>I have so many issues to address. I have a his...</td>\n",
       "      <td>https://counselchat.com/questions/do-i-have-to...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Toni Teixeira, LCSWYour road to healing begins...</td>\n",
       "      <td>https://counselchat.com/therapists/toni-teixei...</td>\n",
       "      <td>I just want to acknowledge you for the courage...</td>\n",
       "      <td>1</td>\n",
       "      <td>256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2770</th>\n",
       "      <td>939</td>\n",
       "      <td>Are some clients more difficult than others?</td>\n",
       "      <td>What are some difficulties that a counselor ca...</td>\n",
       "      <td>https://counselchat.com/questions/are-some-cli...</td>\n",
       "      <td>counseling-fundamentals</td>\n",
       "      <td>Audrey ONealBi-lingual Psychotherapist and Hea...</td>\n",
       "      <td>https://counselchat.com/therapists/audrey-oneal-3</td>\n",
       "      <td>Although many clients have the capacity to be ...</td>\n",
       "      <td>0</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2771</th>\n",
       "      <td>939</td>\n",
       "      <td>Are some clients more difficult than others?</td>\n",
       "      <td>What are some difficulties that a counselor ca...</td>\n",
       "      <td>https://counselchat.com/questions/are-some-cli...</td>\n",
       "      <td>counseling-fundamentals</td>\n",
       "      <td>Kaileen McMickle, MS, LPCLicensed Professional...</td>\n",
       "      <td>https://counselchat.com/therapists/kaileen-mcm...</td>\n",
       "      <td>I usually don't label a client as \"difficult\" ...</td>\n",
       "      <td>0</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2772</th>\n",
       "      <td>939</td>\n",
       "      <td>Are some clients more difficult than others?</td>\n",
       "      <td>What are some difficulties that a counselor ca...</td>\n",
       "      <td>https://counselchat.com/questions/are-some-cli...</td>\n",
       "      <td>counseling-fundamentals</td>\n",
       "      <td>Dr. Timothy Paul'man'; Online - \"Natural Healt...</td>\n",
       "      <td>https://counselchat.com/therapists/dr-timothy-...</td>\n",
       "      <td>Dang right!  :)Heh heh, and correct me if I'm ...</td>\n",
       "      <td>0</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2773</th>\n",
       "      <td>939</td>\n",
       "      <td>Are some clients more difficult than others?</td>\n",
       "      <td>What are some difficulties that a counselor ca...</td>\n",
       "      <td>https://counselchat.com/questions/are-some-cli...</td>\n",
       "      <td>counseling-fundamentals</td>\n",
       "      <td>David KleinHumanistic, LGBT-Affirmative Psycho...</td>\n",
       "      <td>https://counselchat.com/therapists/david-klein</td>\n",
       "      <td>Yes, just like some relationships outside of o...</td>\n",
       "      <td>0</td>\n",
       "      <td>41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>939</td>\n",
       "      <td>Are some clients more difficult than others?</td>\n",
       "      <td>What are some difficulties that a counselor ca...</td>\n",
       "      <td>https://counselchat.com/questions/are-some-cli...</td>\n",
       "      <td>counseling-fundamentals</td>\n",
       "      <td>Sherry Katz, LCSWCouples and Family Therapist,...</td>\n",
       "      <td>https://counselchat.com/therapists/sherry-katz...</td>\n",
       "      <td>Each counselor will have their own list of \"di...</td>\n",
       "      <td>0</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2775 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      questionID                                 questionTitle  \\\n",
       "0              0     Do I have too many issues for counseling?   \n",
       "1              0     Do I have too many issues for counseling?   \n",
       "2              0     Do I have too many issues for counseling?   \n",
       "3              0     Do I have too many issues for counseling?   \n",
       "4              0     Do I have too many issues for counseling?   \n",
       "...          ...                                           ...   \n",
       "2770         939  Are some clients more difficult than others?   \n",
       "2771         939  Are some clients more difficult than others?   \n",
       "2772         939  Are some clients more difficult than others?   \n",
       "2773         939  Are some clients more difficult than others?   \n",
       "2774         939  Are some clients more difficult than others?   \n",
       "\n",
       "                                           questionText  \\\n",
       "0     I have so many issues to address. I have a his...   \n",
       "1     I have so many issues to address. I have a his...   \n",
       "2     I have so many issues to address. I have a his...   \n",
       "3     I have so many issues to address. I have a his...   \n",
       "4     I have so many issues to address. I have a his...   \n",
       "...                                                 ...   \n",
       "2770  What are some difficulties that a counselor ca...   \n",
       "2771  What are some difficulties that a counselor ca...   \n",
       "2772  What are some difficulties that a counselor ca...   \n",
       "2773  What are some difficulties that a counselor ca...   \n",
       "2774  What are some difficulties that a counselor ca...   \n",
       "\n",
       "                                           questionLink  \\\n",
       "0     https://counselchat.com/questions/do-i-have-to...   \n",
       "1     https://counselchat.com/questions/do-i-have-to...   \n",
       "2     https://counselchat.com/questions/do-i-have-to...   \n",
       "3     https://counselchat.com/questions/do-i-have-to...   \n",
       "4     https://counselchat.com/questions/do-i-have-to...   \n",
       "...                                                 ...   \n",
       "2770  https://counselchat.com/questions/are-some-cli...   \n",
       "2771  https://counselchat.com/questions/are-some-cli...   \n",
       "2772  https://counselchat.com/questions/are-some-cli...   \n",
       "2773  https://counselchat.com/questions/are-some-cli...   \n",
       "2774  https://counselchat.com/questions/are-some-cli...   \n",
       "\n",
       "                        topic  \\\n",
       "0                  depression   \n",
       "1                  depression   \n",
       "2                  depression   \n",
       "3                  depression   \n",
       "4                  depression   \n",
       "...                       ...   \n",
       "2770  counseling-fundamentals   \n",
       "2771  counseling-fundamentals   \n",
       "2772  counseling-fundamentals   \n",
       "2773  counseling-fundamentals   \n",
       "2774  counseling-fundamentals   \n",
       "\n",
       "                                          therapistInfo  \\\n",
       "0     Jennifer MolinariHypnotherapist & Licensed Cou...   \n",
       "1     Jason Lynch, MS, LMHC, LCAC, ADSIndividual & C...   \n",
       "2     Shakeeta TorresFaith Based Mental Health Couns...   \n",
       "3     Noorayne ChevalierMA, RP, CCC, CCAC, LLP (Mich...   \n",
       "4     Toni Teixeira, LCSWYour road to healing begins...   \n",
       "...                                                 ...   \n",
       "2770  Audrey ONealBi-lingual Psychotherapist and Hea...   \n",
       "2771  Kaileen McMickle, MS, LPCLicensed Professional...   \n",
       "2772  Dr. Timothy Paul'man'; Online - \"Natural Healt...   \n",
       "2773  David KleinHumanistic, LGBT-Affirmative Psycho...   \n",
       "2774  Sherry Katz, LCSWCouples and Family Therapist,...   \n",
       "\n",
       "                                           therapistURL  \\\n",
       "0     https://counselchat.com/therapists/jennifer-mo...   \n",
       "1     https://counselchat.com/therapists/jason-lynch...   \n",
       "2     https://counselchat.com/therapists/shakeeta-to...   \n",
       "3     https://counselchat.com/therapists/noorayne-ch...   \n",
       "4     https://counselchat.com/therapists/toni-teixei...   \n",
       "...                                                 ...   \n",
       "2770  https://counselchat.com/therapists/audrey-oneal-3   \n",
       "2771  https://counselchat.com/therapists/kaileen-mcm...   \n",
       "2772  https://counselchat.com/therapists/dr-timothy-...   \n",
       "2773     https://counselchat.com/therapists/david-klein   \n",
       "2774  https://counselchat.com/therapists/sherry-katz...   \n",
       "\n",
       "                                             answerText  upvotes  views  \n",
       "0     It is very common for people to have multiple ...        3   1971  \n",
       "1     I've never heard of someone having \"too many i...        2    386  \n",
       "2     Absolutely not.  I strongly recommending worki...        2   3071  \n",
       "3     Let me start by saying there are never too man...        2   2643  \n",
       "4     I just want to acknowledge you for the courage...        1    256  \n",
       "...                                                 ...      ...    ...  \n",
       "2770  Although many clients have the capacity to be ...        0     47  \n",
       "2771  I usually don't label a client as \"difficult\" ...        0     22  \n",
       "2772  Dang right!  :)Heh heh, and correct me if I'm ...        0     23  \n",
       "2773  Yes, just like some relationships outside of o...        0     41  \n",
       "2774  Each counselor will have their own list of \"di...        0     43  \n",
       "\n",
       "[2775 rows x 10 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from datasets import DatasetDict\n",
    "import numpy as np\n",
    "\n",
    "\n",
    "train_ds = dataset1['train']\n",
    "\n",
    "df = train_ds.to_pandas()\n",
    "\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "upvotes\n",
       "0     1939\n",
       "1      506\n",
       "2      183\n",
       "3       80\n",
       "4       41\n",
       "5       13\n",
       "6        4\n",
       "7        4\n",
       "9        3\n",
       "10       1\n",
       "12       1\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['upvotes'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/rd/jwc8pz6n7t9d07lm_6zb3gc80000gn/T/ipykernel_50569/3274451497.py:12: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.\n",
      "  best_rows = df.groupby('questionText', group_keys=False).apply(select_best_answer)\n"
     ]
    }
   ],
   "source": [
    "train_ds = dataset1['train']\n",
    "\n",
    "df = train_ds.to_pandas()\n",
    "# Replace NaNs in upvotes with -1 for sorting logic\n",
    "df['upvotes'] = df['upvotes'].fillna(-1)\n",
    "\n",
    "# Group by questionText\n",
    "def select_best_answer(group):\n",
    "    # If any row has a non-negative upvote, filter those and pick max\n",
    "    if (group['upvotes'] >= 0).any():\n",
    "        return group.loc[group['upvotes'].idxmax()]\n",
    "    else:\n",
    "        return group.loc[group['views'].idxmax()]\n",
    "\n",
    "best_rows = df.groupby('questionText', group_keys=False).apply(select_best_answer)\n",
    "\n",
    "# Convert back to HuggingFace dataset if needed\n",
    "from datasets import Dataset\n",
    "best_dataset = Dataset.from_pandas(best_rows.reset_index(drop=True))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "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>questionID</th>\n",
       "      <th>questionTitle</th>\n",
       "      <th>questionText</th>\n",
       "      <th>questionLink</th>\n",
       "      <th>topic</th>\n",
       "      <th>therapistInfo</th>\n",
       "      <th>therapistURL</th>\n",
       "      <th>answerText</th>\n",
       "      <th>upvotes</th>\n",
       "      <th>views</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>questionText</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>A few nights ago I talked to this girl I know about my self esteem issues for the first time. We talked for hours and she told me time and again that I was a great guy. She told me I was attractive, and have a great personality, etc. I really started to feel better about myself by the time I woke up the next morning. Now, though, I can't stop thinking about her, but I leave to go back to college in a few days and I go to school 4 hours away from her. So now I feel constantly depressed because even if I told her how I felt it wouldn't matter. I feel helpless and I don't know what to do.</th>\n",
       "      <td>353</td>\n",
       "      <td>I'm a 19 year old male with low self esteem. I...</td>\n",
       "      <td>A few nights ago I talked to this girl I know ...</td>\n",
       "      <td>https://counselchat.com/questions/i-m-a-19-yea...</td>\n",
       "      <td>self-esteem</td>\n",
       "      <td>Amy Fortney ParksChild &amp; Adolescent Psychologi...</td>\n",
       "      <td>https://counselchat.com/therapists/amy-fortney...</td>\n",
       "      <td>Hey!  It takes a lot of courage to share your ...</td>\n",
       "      <td>1</td>\n",
       "      <td>232</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A few years ago I was making love to my wife when for no known reason I lost my erection,    Now I'm In my early 30s and my problem has become more and more frequent. This is causing major problems for my ego and it's diminishing my self esteem. This has resulted in ongoing depression and tearing apart my marriage.    I am devastated and cannot find a cause for these issues. I am very attracted to my wife and want to express it in the bedroom like I used to.    What could be causing this, and what can I do about it?</th>\n",
       "      <td>11</td>\n",
       "      <td>Why am I experiencing dfficulty maintaining an...</td>\n",
       "      <td>A few years ago I was making love to my wife w...</td>\n",
       "      <td>https://counselchat.com/questions/why-am-i-exp...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Sherry Katz, LCSWCouples and Family Therapist,...</td>\n",
       "      <td>https://counselchat.com/therapists/sherry-katz...</td>\n",
       "      <td>First step always is to do a medical rule out ...</td>\n",
       "      <td>1</td>\n",
       "      <td>138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A friend of mine taking psychology advised I go to my doctor to check if I have major depressive disorder. I'm afraid of the consequences of doing so. If I do become diagnosed with major depressive disorder, won’t that go on my records? I will never be able to become a counselor along with a list of other things I may be prohibited from. I’m also afraid of taking any anti-depressants. This year, my doctor gave me some for a \"dislocated hip.\" I had a severe reaction and passed out moments after taking them. Everyone I know who has taken anti-depressants says it’s a bad idea all around and you’re better getting treatment without them. I’m concerned they might take me to a clinic and force me to take medication because I am unable to make decisions on my own. I’m not really suicidal, but I am not really taking care of myself either. Someone also told me they still use electroshock therapy. I’m not keen on that. I’m wondering if I am better off just getting self-help and working things out on my own. It’s just that I've been an emotional mess since I was in elementary school. I’ve graduated now and tried to stay positive and be happy, but I cannot deny I still am not good.</th>\n",
       "      <td>127</td>\n",
       "      <td>I'm scared to go to a doctor or take anti-depr...</td>\n",
       "      <td>A friend of mine taking psychology advised I g...</td>\n",
       "      <td>https://counselchat.com/questions/i-m-scared-t...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Sherry Katz, LCSWCouples and Family Therapist,...</td>\n",
       "      <td>https://counselchat.com/therapists/sherry-katz...</td>\n",
       "      <td>I admire your courage for stating your view ab...</td>\n",
       "      <td>1</td>\n",
       "      <td>179</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A girl and I were madly in love. We dated for over a year and were even talking about marriage and future plans together. She moved away for school, and we attempted a long distance relationship. We eventually broke up. It's been a year now, and I still haven't lost my feelings for her. I still love her the same way I did. I've suffered from depression ever since the breakup and have been unable to connect with anyone else. It's damaging me and my life.</th>\n",
       "      <td>111</td>\n",
       "      <td>I'm depressed and unable to connect with peopl...</td>\n",
       "      <td>A girl and I were madly in love. We dated for ...</td>\n",
       "      <td>https://counselchat.com/questions/i-m-depresse...</td>\n",
       "      <td>depression</td>\n",
       "      <td>Lynda MartensMarriage &amp; Family Therapist, MSc,...</td>\n",
       "      <td>https://counselchat.com/therapists/ms-lynda-ma...</td>\n",
       "      <td>Hi Boise, I'm sorry that you've lost this love...</td>\n",
       "      <td>2</td>\n",
       "      <td>125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A lot of times, I avoid situations where I am to meet new people because I have a fear of embarrassing myself. I often avoid large groups of people, like parties, because I think they all constantly judge me.</th>\n",
       "      <td>193</td>\n",
       "      <td>How can I get over my fear of public embarrass...</td>\n",
       "      <td>A lot of times, I avoid situations where I am ...</td>\n",
       "      <td>https://counselchat.com/questions/how-can-i-ge...</td>\n",
       "      <td>anxiety</td>\n",
       "      <td>Robin Landwehr, DBH, LPCC, NCCMental Health in...</td>\n",
       "      <td>https://counselchat.com/therapists/robin-landw...</td>\n",
       "      <td>Hello, and thank you for your question. First,...</td>\n",
       "      <td>1</td>\n",
       "      <td>345</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Why am I attracted to older men?</th>\n",
       "      <td>800</td>\n",
       "      <td>Why do I feel like I need a man in my life?</td>\n",
       "      <td>Why am I attracted to older men?</td>\n",
       "      <td>https://counselchat.com/questions/why-do-i-fee...</td>\n",
       "      <td>relationships</td>\n",
       "      <td>Sherry Katz, LCSWCouples and Family Therapist,...</td>\n",
       "      <td>https://counselchat.com/therapists/sherry-katz...</td>\n",
       "      <td>What a wonderful question!Good for you on clea...</td>\n",
       "      <td>2</td>\n",
       "      <td>171</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Why am I so afraid of it? I don't understand.</th>\n",
       "      <td>212</td>\n",
       "      <td>How can I be less afraid of rape?</td>\n",
       "      <td>Why am I so afraid of it? I don't understand.</td>\n",
       "      <td>https://counselchat.com/questions/how-can-i-be...</td>\n",
       "      <td>anxiety</td>\n",
       "      <td>Sherry Katz, LCSWCouples and Family Therapist,...</td>\n",
       "      <td>https://counselchat.com/therapists/sherry-katz...</td>\n",
       "      <td>Your fear is somewhat reasonable.  No one want...</td>\n",
       "      <td>2</td>\n",
       "      <td>229</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>With college over, my boyfriend and I have such different work schedules. Since I can't see him often, I want to talk more on the phone. He plays video games while talking to players, so often I feel ignored. I find myself always telling him what to do in relation to me, things he should know.</th>\n",
       "      <td>511</td>\n",
       "      <td>How can I address my grievances to my boyfriend?</td>\n",
       "      <td>With college over, my boyfriend and I have suc...</td>\n",
       "      <td>https://counselchat.com/questions/how-can-i-ad...</td>\n",
       "      <td>intimacy</td>\n",
       "      <td>Sherry Katz, LCSWCouples and Family Therapist,...</td>\n",
       "      <td>https://counselchat.com/therapists/sherry-katz...</td>\n",
       "      <td>Directly tell him what you write here.Either h...</td>\n",
       "      <td>0</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>he just walks in the house whenever he wants to see his kids. My fiancé tells me it makes her angry and doesn't like it, but she seems afraid to say anything to him about it for some reason. Is it okay for him to do this?</th>\n",
       "      <td>253</td>\n",
       "      <td>My fiancé's ex-husband shows up unannounced</td>\n",
       "      <td>he just walks in the house whenever he wants t...</td>\n",
       "      <td>https://counselchat.com/questions/my-fianc-s-e...</td>\n",
       "      <td>parenting</td>\n",
       "      <td>Frank TheusMA, LPC, NCC, CSAT</td>\n",
       "      <td>https://counselchat.com/therapists/frank-theus</td>\n",
       "      <td>The short answer to your question is \"No\" it's...</td>\n",
       "      <td>2</td>\n",
       "      <td>380</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i was addicted to porn since the second grade. I'm in my early 40s and overcame my addiction during my separation from my wife of 15 years.</th>\n",
       "      <td>767</td>\n",
       "      <td>How can I rebuild the trust I destroyed from m...</td>\n",
       "      <td>i was addicted to porn since the second grade....</td>\n",
       "      <td>https://counselchat.com/questions/how-can-i-re...</td>\n",
       "      <td>relationships</td>\n",
       "      <td>Sonya WilsonLicensed Professional Counselor</td>\n",
       "      <td>https://counselchat.com/therapists/sonya-wilson</td>\n",
       "      <td>The person who can answer this question is the...</td>\n",
       "      <td>0</td>\n",
       "      <td>113</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>865 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                    questionID  \\\n",
       "questionText                                                     \n",
       "A few nights ago I talked to this girl I know a...         353   \n",
       "A few years ago I was making love to my wife wh...          11   \n",
       "A friend of mine taking psychology advised I go...         127   \n",
       "A girl and I were madly in love. We dated for o...         111   \n",
       "A lot of times, I avoid situations where I am t...         193   \n",
       "...                                                        ...   \n",
       "Why am I attracted to older men?                           800   \n",
       "Why am I so afraid of it? I don't understand.              212   \n",
       "With college over, my boyfriend and I have such...         511   \n",
       "he just walks in the house whenever he wants to...         253   \n",
       "i was addicted to porn since the second grade. ...         767   \n",
       "\n",
       "                                                                                        questionTitle  \\\n",
       "questionText                                                                                            \n",
       "A few nights ago I talked to this girl I know a...  I'm a 19 year old male with low self esteem. I...   \n",
       "A few years ago I was making love to my wife wh...  Why am I experiencing dfficulty maintaining an...   \n",
       "A friend of mine taking psychology advised I go...  I'm scared to go to a doctor or take anti-depr...   \n",
       "A girl and I were madly in love. We dated for o...  I'm depressed and unable to connect with peopl...   \n",
       "A lot of times, I avoid situations where I am t...  How can I get over my fear of public embarrass...   \n",
       "...                                                                                               ...   \n",
       "Why am I attracted to older men?                          Why do I feel like I need a man in my life?   \n",
       "Why am I so afraid of it? I don't understand.                       How can I be less afraid of rape?   \n",
       "With college over, my boyfriend and I have such...   How can I address my grievances to my boyfriend?   \n",
       "he just walks in the house whenever he wants to...        My fiancé's ex-husband shows up unannounced   \n",
       "i was addicted to porn since the second grade. ...  How can I rebuild the trust I destroyed from m...   \n",
       "\n",
       "                                                                                         questionText  \\\n",
       "questionText                                                                                            \n",
       "A few nights ago I talked to this girl I know a...  A few nights ago I talked to this girl I know ...   \n",
       "A few years ago I was making love to my wife wh...  A few years ago I was making love to my wife w...   \n",
       "A friend of mine taking psychology advised I go...  A friend of mine taking psychology advised I g...   \n",
       "A girl and I were madly in love. We dated for o...  A girl and I were madly in love. We dated for ...   \n",
       "A lot of times, I avoid situations where I am t...  A lot of times, I avoid situations where I am ...   \n",
       "...                                                                                               ...   \n",
       "Why am I attracted to older men?                                     Why am I attracted to older men?   \n",
       "Why am I so afraid of it? I don't understand.           Why am I so afraid of it? I don't understand.   \n",
       "With college over, my boyfriend and I have such...  With college over, my boyfriend and I have suc...   \n",
       "he just walks in the house whenever he wants to...  he just walks in the house whenever he wants t...   \n",
       "i was addicted to porn since the second grade. ...  i was addicted to porn since the second grade....   \n",
       "\n",
       "                                                                                         questionLink  \\\n",
       "questionText                                                                                            \n",
       "A few nights ago I talked to this girl I know a...  https://counselchat.com/questions/i-m-a-19-yea...   \n",
       "A few years ago I was making love to my wife wh...  https://counselchat.com/questions/why-am-i-exp...   \n",
       "A friend of mine taking psychology advised I go...  https://counselchat.com/questions/i-m-scared-t...   \n",
       "A girl and I were madly in love. We dated for o...  https://counselchat.com/questions/i-m-depresse...   \n",
       "A lot of times, I avoid situations where I am t...  https://counselchat.com/questions/how-can-i-ge...   \n",
       "...                                                                                               ...   \n",
       "Why am I attracted to older men?                    https://counselchat.com/questions/why-do-i-fee...   \n",
       "Why am I so afraid of it? I don't understand.       https://counselchat.com/questions/how-can-i-be...   \n",
       "With college over, my boyfriend and I have such...  https://counselchat.com/questions/how-can-i-ad...   \n",
       "he just walks in the house whenever he wants to...  https://counselchat.com/questions/my-fianc-s-e...   \n",
       "i was addicted to porn since the second grade. ...  https://counselchat.com/questions/how-can-i-re...   \n",
       "\n",
       "                                                            topic  \\\n",
       "questionText                                                        \n",
       "A few nights ago I talked to this girl I know a...    self-esteem   \n",
       "A few years ago I was making love to my wife wh...     depression   \n",
       "A friend of mine taking psychology advised I go...     depression   \n",
       "A girl and I were madly in love. We dated for o...     depression   \n",
       "A lot of times, I avoid situations where I am t...        anxiety   \n",
       "...                                                           ...   \n",
       "Why am I attracted to older men?                    relationships   \n",
       "Why am I so afraid of it? I don't understand.             anxiety   \n",
       "With college over, my boyfriend and I have such...       intimacy   \n",
       "he just walks in the house whenever he wants to...      parenting   \n",
       "i was addicted to porn since the second grade. ...  relationships   \n",
       "\n",
       "                                                                                        therapistInfo  \\\n",
       "questionText                                                                                            \n",
       "A few nights ago I talked to this girl I know a...  Amy Fortney ParksChild & Adolescent Psychologi...   \n",
       "A few years ago I was making love to my wife wh...  Sherry Katz, LCSWCouples and Family Therapist,...   \n",
       "A friend of mine taking psychology advised I go...  Sherry Katz, LCSWCouples and Family Therapist,...   \n",
       "A girl and I were madly in love. We dated for o...  Lynda MartensMarriage & Family Therapist, MSc,...   \n",
       "A lot of times, I avoid situations where I am t...  Robin Landwehr, DBH, LPCC, NCCMental Health in...   \n",
       "...                                                                                               ...   \n",
       "Why am I attracted to older men?                    Sherry Katz, LCSWCouples and Family Therapist,...   \n",
       "Why am I so afraid of it? I don't understand.       Sherry Katz, LCSWCouples and Family Therapist,...   \n",
       "With college over, my boyfriend and I have such...  Sherry Katz, LCSWCouples and Family Therapist,...   \n",
       "he just walks in the house whenever he wants to...                      Frank TheusMA, LPC, NCC, CSAT   \n",
       "i was addicted to porn since the second grade. ...        Sonya WilsonLicensed Professional Counselor   \n",
       "\n",
       "                                                                                         therapistURL  \\\n",
       "questionText                                                                                            \n",
       "A few nights ago I talked to this girl I know a...  https://counselchat.com/therapists/amy-fortney...   \n",
       "A few years ago I was making love to my wife wh...  https://counselchat.com/therapists/sherry-katz...   \n",
       "A friend of mine taking psychology advised I go...  https://counselchat.com/therapists/sherry-katz...   \n",
       "A girl and I were madly in love. We dated for o...  https://counselchat.com/therapists/ms-lynda-ma...   \n",
       "A lot of times, I avoid situations where I am t...  https://counselchat.com/therapists/robin-landw...   \n",
       "...                                                                                               ...   \n",
       "Why am I attracted to older men?                    https://counselchat.com/therapists/sherry-katz...   \n",
       "Why am I so afraid of it? I don't understand.       https://counselchat.com/therapists/sherry-katz...   \n",
       "With college over, my boyfriend and I have such...  https://counselchat.com/therapists/sherry-katz...   \n",
       "he just walks in the house whenever he wants to...     https://counselchat.com/therapists/frank-theus   \n",
       "i was addicted to porn since the second grade. ...    https://counselchat.com/therapists/sonya-wilson   \n",
       "\n",
       "                                                                                           answerText  \\\n",
       "questionText                                                                                            \n",
       "A few nights ago I talked to this girl I know a...  Hey!  It takes a lot of courage to share your ...   \n",
       "A few years ago I was making love to my wife wh...  First step always is to do a medical rule out ...   \n",
       "A friend of mine taking psychology advised I go...  I admire your courage for stating your view ab...   \n",
       "A girl and I were madly in love. We dated for o...  Hi Boise, I'm sorry that you've lost this love...   \n",
       "A lot of times, I avoid situations where I am t...  Hello, and thank you for your question. First,...   \n",
       "...                                                                                               ...   \n",
       "Why am I attracted to older men?                    What a wonderful question!Good for you on clea...   \n",
       "Why am I so afraid of it? I don't understand.       Your fear is somewhat reasonable.  No one want...   \n",
       "With college over, my boyfriend and I have such...  Directly tell him what you write here.Either h...   \n",
       "he just walks in the house whenever he wants to...  The short answer to your question is \"No\" it's...   \n",
       "i was addicted to porn since the second grade. ...  The person who can answer this question is the...   \n",
       "\n",
       "                                                    upvotes  views  \n",
       "questionText                                                        \n",
       "A few nights ago I talked to this girl I know a...        1    232  \n",
       "A few years ago I was making love to my wife wh...        1    138  \n",
       "A friend of mine taking psychology advised I go...        1    179  \n",
       "A girl and I were madly in love. We dated for o...        2    125  \n",
       "A lot of times, I avoid situations where I am t...        1    345  \n",
       "...                                                     ...    ...  \n",
       "Why am I attracted to older men?                          2    171  \n",
       "Why am I so afraid of it? I don't understand.             2    229  \n",
       "With college over, my boyfriend and I have such...        0     75  \n",
       "he just walks in the house whenever he wants to...        2    380  \n",
       "i was addicted to porn since the second grade. ...        0    113  \n",
       "\n",
       "[865 rows x 10 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "best_rows"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# https://huggingface.co/datasets/Amod/mental_health_counseling_conversations\n",
    "import pandas as pd\n",
    "# Login using e.g. `huggingface-cli login` to access this dataset\n",
    "df = pd.read_json(\n",
    "    \"data/combined_dataset.json\", lines=True\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'Context': \"I'm going through some things with my feelings and myself. I barely sleep and I do nothing but think about how I'm worthless and how I shouldn't be here.\\n   I've never tried or contemplated suicide. I've always wanted to fix my issues, but I never get around to it.\\n   How can I change my feeling of being worthless to everyone?\", 'Response': \"If everyone thinks you're worthless, then maybe you need to find new people to hang out with.Seriously, the social context in which a person lives is a big influence in self-esteem.Otherwise, you can go round and round trying to understand why you're not worthless, then go back to the same crowd and be knocked down again.There are many inspirational messages you can find in social media. \\xa0Maybe read some of the ones which state that no person is worthless, and that everyone has a good purpose to their life.Also, since our culture is so saturated with the belief that if someone doesn't feel good about themselves that this is somehow terrible.Bad feelings are part of living. \\xa0They are the motivation to remove ourselves from situations and relationships which do us more harm than good.Bad feelings do feel terrible. \\xa0 Your feeling of worthlessness may be good in the sense of motivating you to find out that you are much better than your feelings today.\"}\n"
     ]
    }
   ],
   "source": [
    "data = []\n",
    "with open(\"data/combined_dataset.json\", \"r\") as f:\n",
    "    for line in f:\n",
    "        data.append(json.loads(line))\n",
    "\n",
    "# Example: print one record\n",
    "print(data[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "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>Context</th>\n",
       "      <th>Response</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>I'm going through some things with my feelings...</td>\n",
       "      <td>If everyone thinks you're worthless, then mayb...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>I'm going through some things with my feelings...</td>\n",
       "      <td>Hello, and thank you for your question and see...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>I'm going through some things with my feelings...</td>\n",
       "      <td>First thing I'd suggest is getting the sleep y...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>I'm going through some things with my feelings...</td>\n",
       "      <td>Therapy is essential for those that are feelin...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>I'm going through some things with my feelings...</td>\n",
       "      <td>I first want to let you know that you are not ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3507</th>\n",
       "      <td>My grandson's step-mother sends him to school ...</td>\n",
       "      <td>Absolutely not! It is never in a child's best ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3508</th>\n",
       "      <td>My boyfriend is in recovery from drug addictio...</td>\n",
       "      <td>I'm sorry you have tension between you and you...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3509</th>\n",
       "      <td>The birth mother attempted suicide several tim...</td>\n",
       "      <td>The true answer is, \"no one can really say wit...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3510</th>\n",
       "      <td>I think adult life is making him depressed and...</td>\n",
       "      <td>How do you help yourself to believe you requir...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3511</th>\n",
       "      <td>I just took a job that requires me to travel f...</td>\n",
       "      <td>hmm this is a tough one!</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3512 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Context  \\\n",
       "0     I'm going through some things with my feelings...   \n",
       "1     I'm going through some things with my feelings...   \n",
       "2     I'm going through some things with my feelings...   \n",
       "3     I'm going through some things with my feelings...   \n",
       "4     I'm going through some things with my feelings...   \n",
       "...                                                 ...   \n",
       "3507  My grandson's step-mother sends him to school ...   \n",
       "3508  My boyfriend is in recovery from drug addictio...   \n",
       "3509  The birth mother attempted suicide several tim...   \n",
       "3510  I think adult life is making him depressed and...   \n",
       "3511  I just took a job that requires me to travel f...   \n",
       "\n",
       "                                               Response  \n",
       "0     If everyone thinks you're worthless, then mayb...  \n",
       "1     Hello, and thank you for your question and see...  \n",
       "2     First thing I'd suggest is getting the sleep y...  \n",
       "3     Therapy is essential for those that are feelin...  \n",
       "4     I first want to let you know that you are not ...  \n",
       "...                                                 ...  \n",
       "3507  Absolutely not! It is never in a child's best ...  \n",
       "3508  I'm sorry you have tension between you and you...  \n",
       "3509  The true answer is, \"no one can really say wit...  \n",
       "3510  How do you help yourself to believe you requir...  \n",
       "3511                           hmm this is a tough one!  \n",
       "\n",
       "[3512 rows x 2 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "tellme_env (3.13.5)",
   "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.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}