kisejin commited on
Commit
4623b55
·
verified ·
1 Parent(s): 83c7ff9

Upload Copy_of_manhos_16_aspects (1).ipynb

Browse files
Files changed (1) hide show
  1. Copy_of_manhos_16_aspects (1).ipynb +92 -299
Copy_of_manhos_16_aspects (1).ipynb CHANGED
@@ -1,36 +1,5 @@
1
  {
2
  "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 16,
6
- "id": "tlI2baZJDVIn",
7
- "metadata": {
8
- "ExecuteTime": {
9
- "end_time": "2024-03-12T09:52:59.414623Z",
10
- "start_time": "2024-03-12T09:52:59.390978Z"
11
- },
12
- "colab": {
13
- "base_uri": "https://localhost:8080/",
14
- "height": 318
15
- },
16
- "id": "tlI2baZJDVIn",
17
- "outputId": "b62cdc94-811a-489b-ee63-8749887e98c5"
18
- },
19
- "outputs": [
20
- {
21
- "ename": "ModuleNotFoundError",
22
- "evalue": "No module named 'google.colab'",
23
- "output_type": "error",
24
- "traceback": [
25
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
26
- "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
27
- "Cell \u001b[0;32mIn[16], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mgoogle\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcolab\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m drive\n\u001b[1;32m 2\u001b[0m drive\u001b[38;5;241m.\u001b[39mmount(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/content/drive\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
28
- "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'google.colab'"
29
- ]
30
- }
31
- ],
32
- "source": []
33
- },
34
  {
35
  "cell_type": "code",
36
  "execution_count": 17,
@@ -99,7 +68,19 @@
99
  }
100
  ],
101
  "source": [
102
- "!pip install sentence_transformers umap hdbscan"
 
 
 
 
 
 
 
 
 
 
 
 
103
  ]
104
  },
105
  {
@@ -149,17 +130,7 @@
149
  "outputs": [
150
  {
151
  "data": {
152
- "application/javascript": [
153
- "if (!(\"Notification\" in window)) {\n",
154
- " alert(\"This browser does not support desktop notifications, so the %%notify magic will not work.\");\n",
155
- "} else if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {\n",
156
- " Notification.requestPermission(function (permission) {\n",
157
- " if(!('permission' in Notification)) {\n",
158
- " Notification.permission = permission;\n",
159
- " }\n",
160
- " })\n",
161
- "}\n"
162
- ],
163
  "text/plain": [
164
  "<IPython.core.display.Javascript object>"
165
  ]
@@ -579,47 +550,7 @@
579
  "outputs": [
580
  {
581
  "data": {
582
- "application/javascript": [
583
- "$(document).ready(\n",
584
- " function() {\n",
585
- " function appendUniqueDiv(){\n",
586
- " // append a div with our uuid so we can check that it's already\n",
587
- " // been sent and avoid duplicates on page reload\n",
588
- " var notifiedDiv = document.createElement(\"div\")\n",
589
- " notifiedDiv.id = \"14ecef73-659b-4bb8-9b20-bdff5827a235\"\n",
590
- " element.append(notifiedDiv)\n",
591
- " }\n",
592
- "\n",
593
- " // only send notifications if the pageload is complete; this will\n",
594
- " // help stop extra notifications when a saved notebook is loaded,\n",
595
- " // which during testing gives us state \"interactive\", not \"complete\"\n",
596
- " if (document.readyState === 'complete') {\n",
597
- " // check for the div that signifies that the notification\n",
598
- " // was already sent\n",
599
- " if (document.getElementById(\"14ecef73-659b-4bb8-9b20-bdff5827a235\") === null) {\n",
600
- " var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n",
601
- " if (Notification.permission !== 'denied') {\n",
602
- " if (Notification.permission !== 'granted') { \n",
603
- " Notification.requestPermission(function (permission) {\n",
604
- " if(!('permission' in Notification)) {\n",
605
- " Notification.permission = permission\n",
606
- " }\n",
607
- " })\n",
608
- " }\n",
609
- " if (Notification.permission === 'granted') {\n",
610
- " var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n",
611
- " appendUniqueDiv()\n",
612
- " notification.onclick = function () {\n",
613
- " window.focus();\n",
614
- " this.close();\n",
615
- " };\n",
616
- " } \n",
617
- " } \n",
618
- " }\n",
619
- " }\n",
620
- " }\n",
621
- ")\n"
622
- ],
623
  "text/plain": [
624
  "<IPython.core.display.Javascript object>"
625
  ]
@@ -1868,47 +1799,7 @@
1868
  "outputs": [
1869
  {
1870
  "data": {
1871
- "application/javascript": [
1872
- "$(document).ready(\n",
1873
- " function() {\n",
1874
- " function appendUniqueDiv(){\n",
1875
- " // append a div with our uuid so we can check that it's already\n",
1876
- " // been sent and avoid duplicates on page reload\n",
1877
- " var notifiedDiv = document.createElement(\"div\")\n",
1878
- " notifiedDiv.id = \"c00237ed-2c6a-489c-b1e4-26918a14ad85\"\n",
1879
- " element.append(notifiedDiv)\n",
1880
- " }\n",
1881
- "\n",
1882
- " // only send notifications if the pageload is complete; this will\n",
1883
- " // help stop extra notifications when a saved notebook is loaded,\n",
1884
- " // which during testing gives us state \"interactive\", not \"complete\"\n",
1885
- " if (document.readyState === 'complete') {\n",
1886
- " // check for the div that signifies that the notification\n",
1887
- " // was already sent\n",
1888
- " if (document.getElementById(\"c00237ed-2c6a-489c-b1e4-26918a14ad85\") === null) {\n",
1889
- " var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n",
1890
- " if (Notification.permission !== 'denied') {\n",
1891
- " if (Notification.permission !== 'granted') { \n",
1892
- " Notification.requestPermission(function (permission) {\n",
1893
- " if(!('permission' in Notification)) {\n",
1894
- " Notification.permission = permission\n",
1895
- " }\n",
1896
- " })\n",
1897
- " }\n",
1898
- " if (Notification.permission === 'granted') {\n",
1899
- " var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n",
1900
- " appendUniqueDiv()\n",
1901
- " notification.onclick = function () {\n",
1902
- " window.focus();\n",
1903
- " this.close();\n",
1904
- " };\n",
1905
- " } \n",
1906
- " } \n",
1907
- " }\n",
1908
- " }\n",
1909
- " }\n",
1910
- ")\n"
1911
- ],
1912
  "text/plain": [
1913
  "<IPython.core.display.Javascript object>"
1914
  ]
@@ -2448,47 +2339,7 @@
2448
  },
2449
  {
2450
  "data": {
2451
- "application/javascript": [
2452
- "$(document).ready(\n",
2453
- " function() {\n",
2454
- " function appendUniqueDiv(){\n",
2455
- " // append a div with our uuid so we can check that it's already\n",
2456
- " // been sent and avoid duplicates on page reload\n",
2457
- " var notifiedDiv = document.createElement(\"div\")\n",
2458
- " notifiedDiv.id = \"c95b16e8-082b-4e2d-a87a-ad40b5a15f5f\"\n",
2459
- " element.append(notifiedDiv)\n",
2460
- " }\n",
2461
- "\n",
2462
- " // only send notifications if the pageload is complete; this will\n",
2463
- " // help stop extra notifications when a saved notebook is loaded,\n",
2464
- " // which during testing gives us state \"interactive\", not \"complete\"\n",
2465
- " if (document.readyState === 'complete') {\n",
2466
- " // check for the div that signifies that the notification\n",
2467
- " // was already sent\n",
2468
- " if (document.getElementById(\"c95b16e8-082b-4e2d-a87a-ad40b5a15f5f\") === null) {\n",
2469
- " var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n",
2470
- " if (Notification.permission !== 'denied') {\n",
2471
- " if (Notification.permission !== 'granted') { \n",
2472
- " Notification.requestPermission(function (permission) {\n",
2473
- " if(!('permission' in Notification)) {\n",
2474
- " Notification.permission = permission\n",
2475
- " }\n",
2476
- " })\n",
2477
- " }\n",
2478
- " if (Notification.permission === 'granted') {\n",
2479
- " var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n",
2480
- " appendUniqueDiv()\n",
2481
- " notification.onclick = function () {\n",
2482
- " window.focus();\n",
2483
- " this.close();\n",
2484
- " };\n",
2485
- " } \n",
2486
- " } \n",
2487
- " }\n",
2488
- " }\n",
2489
- " }\n",
2490
- ")\n"
2491
- ],
2492
  "text/plain": [
2493
  "<IPython.core.display.Javascript object>"
2494
  ]
@@ -2572,47 +2423,7 @@
2572
  },
2573
  {
2574
  "data": {
2575
- "application/javascript": [
2576
- "$(document).ready(\n",
2577
- " function() {\n",
2578
- " function appendUniqueDiv(){\n",
2579
- " // append a div with our uuid so we can check that it's already\n",
2580
- " // been sent and avoid duplicates on page reload\n",
2581
- " var notifiedDiv = document.createElement(\"div\")\n",
2582
- " notifiedDiv.id = \"b05e6bc3-989f-4f7b-91ec-7d092cf21e12\"\n",
2583
- " element.append(notifiedDiv)\n",
2584
- " }\n",
2585
- "\n",
2586
- " // only send notifications if the pageload is complete; this will\n",
2587
- " // help stop extra notifications when a saved notebook is loaded,\n",
2588
- " // which during testing gives us state \"interactive\", not \"complete\"\n",
2589
- " if (document.readyState === 'complete') {\n",
2590
- " // check for the div that signifies that the notification\n",
2591
- " // was already sent\n",
2592
- " if (document.getElementById(\"b05e6bc3-989f-4f7b-91ec-7d092cf21e12\") === null) {\n",
2593
- " var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n",
2594
- " if (Notification.permission !== 'denied') {\n",
2595
- " if (Notification.permission !== 'granted') { \n",
2596
- " Notification.requestPermission(function (permission) {\n",
2597
- " if(!('permission' in Notification)) {\n",
2598
- " Notification.permission = permission\n",
2599
- " }\n",
2600
- " })\n",
2601
- " }\n",
2602
- " if (Notification.permission === 'granted') {\n",
2603
- " var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n",
2604
- " appendUniqueDiv()\n",
2605
- " notification.onclick = function () {\n",
2606
- " window.focus();\n",
2607
- " this.close();\n",
2608
- " };\n",
2609
- " } \n",
2610
- " } \n",
2611
- " }\n",
2612
- " }\n",
2613
- " }\n",
2614
- ")\n"
2615
- ],
2616
  "text/plain": [
2617
  "<IPython.core.display.Javascript object>"
2618
  ]
@@ -3235,6 +3046,42 @@
3235
  " f.write(json.dumps(str(topic_keyword_weights),indent=4, ensure_ascii=False))"
3236
  ]
3237
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3238
  {
3239
  "cell_type": "code",
3240
  "execution_count": 32,
@@ -8079,47 +7926,7 @@
8079
  },
8080
  {
8081
  "data": {
8082
- "application/javascript": [
8083
- "$(document).ready(\n",
8084
- " function() {\n",
8085
- " function appendUniqueDiv(){\n",
8086
- " // append a div with our uuid so we can check that it's already\n",
8087
- " // been sent and avoid duplicates on page reload\n",
8088
- " var notifiedDiv = document.createElement(\"div\")\n",
8089
- " notifiedDiv.id = \"2509d570-7cd9-4cbb-a9f3-9fa5e2d7877a\"\n",
8090
- " element.append(notifiedDiv)\n",
8091
- " }\n",
8092
- "\n",
8093
- " // only send notifications if the pageload is complete; this will\n",
8094
- " // help stop extra notifications when a saved notebook is loaded,\n",
8095
- " // which during testing gives us state \"interactive\", not \"complete\"\n",
8096
- " if (document.readyState === 'complete') {\n",
8097
- " // check for the div that signifies that the notification\n",
8098
- " // was already sent\n",
8099
- " if (document.getElementById(\"2509d570-7cd9-4cbb-a9f3-9fa5e2d7877a\") === null) {\n",
8100
- " var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n",
8101
- " if (Notification.permission !== 'denied') {\n",
8102
- " if (Notification.permission !== 'granted') { \n",
8103
- " Notification.requestPermission(function (permission) {\n",
8104
- " if(!('permission' in Notification)) {\n",
8105
- " Notification.permission = permission\n",
8106
- " }\n",
8107
- " })\n",
8108
- " }\n",
8109
- " if (Notification.permission === 'granted') {\n",
8110
- " var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n",
8111
- " appendUniqueDiv()\n",
8112
- " notification.onclick = function () {\n",
8113
- " window.focus();\n",
8114
- " this.close();\n",
8115
- " };\n",
8116
- " } \n",
8117
- " } \n",
8118
- " }\n",
8119
- " }\n",
8120
- " }\n",
8121
- ")\n"
8122
- ],
8123
  "text/plain": [
8124
  "<IPython.core.display.Javascript object>"
8125
  ]
@@ -38725,47 +38532,7 @@
38725
  },
38726
  {
38727
  "data": {
38728
- "application/javascript": [
38729
- "$(document).ready(\n",
38730
- " function() {\n",
38731
- " function appendUniqueDiv(){\n",
38732
- " // append a div with our uuid so we can check that it's already\n",
38733
- " // been sent and avoid duplicates on page reload\n",
38734
- " var notifiedDiv = document.createElement(\"div\")\n",
38735
- " notifiedDiv.id = \"6b8a098b-aca8-4f94-802d-46019aed94dc\"\n",
38736
- " element.append(notifiedDiv)\n",
38737
- " }\n",
38738
- "\n",
38739
- " // only send notifications if the pageload is complete; this will\n",
38740
- " // help stop extra notifications when a saved notebook is loaded,\n",
38741
- " // which during testing gives us state \"interactive\", not \"complete\"\n",
38742
- " if (document.readyState === 'complete') {\n",
38743
- " // check for the div that signifies that the notification\n",
38744
- " // was already sent\n",
38745
- " if (document.getElementById(\"6b8a098b-aca8-4f94-802d-46019aed94dc\") === null) {\n",
38746
- " var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n",
38747
- " if (Notification.permission !== 'denied') {\n",
38748
- " if (Notification.permission !== 'granted') { \n",
38749
- " Notification.requestPermission(function (permission) {\n",
38750
- " if(!('permission' in Notification)) {\n",
38751
- " Notification.permission = permission\n",
38752
- " }\n",
38753
- " })\n",
38754
- " }\n",
38755
- " if (Notification.permission === 'granted') {\n",
38756
- " var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n",
38757
- " appendUniqueDiv()\n",
38758
- " notification.onclick = function () {\n",
38759
- " window.focus();\n",
38760
- " this.close();\n",
38761
- " };\n",
38762
- " } \n",
38763
- " } \n",
38764
- " }\n",
38765
- " }\n",
38766
- " }\n",
38767
- ")\n"
38768
- ],
38769
  "text/plain": [
38770
  "<IPython.core.display.Javascript object>"
38771
  ]
@@ -38860,16 +38627,6 @@
38860
  "topic_info"
38861
  ]
38862
  },
38863
- {
38864
- "cell_type": "code",
38865
- "execution_count": null,
38866
- "id": "50324fb3-dd8d-42b0-9724-72d197d2b3ea",
38867
- "metadata": {},
38868
- "outputs": [],
38869
- "source": [
38870
- "1"
38871
- ]
38872
- },
38873
  {
38874
  "cell_type": "code",
38875
  "execution_count": null,
@@ -38950,6 +38707,42 @@
38950
  " f.write(json.dumps(str(topic_keyword_weights),indent=4, ensure_ascii=False))"
38951
  ]
38952
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38953
  {
38954
  "cell_type": "code",
38955
  "execution_count": null,
 
1
  {
2
  "cells": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  {
4
  "cell_type": "code",
5
  "execution_count": 17,
 
68
  }
69
  ],
70
  "source": [
71
+ "!python -m pip install git+https://github.com/huggingface/transformers.git\n",
72
+ "!python -m pip install pytorch-crf\n",
73
+ "!python -m pip install --upgrade pip\n",
74
+ "!python -m pip install -r requirements.txt\n",
75
+ "!python -m pip install \\\n",
76
+ " --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple \\\n",
77
+ " \"cudf-cu12>=24.4.0a0,<=24.4\" \"dask-cudf-cu12>=24.4.0a0,<=24.4\" \\\n",
78
+ " \"cuml-cu12>=24.4.0a0,<=24.4\" \"cugraph-cu12>=24.4.0a0,<=24.4\" \\\n",
79
+ " \"cuspatial-cu12>=24.4.0a0,<=24.4\" \"cuproj-cu12>=24.4.0a0,<=24.4\" \\\n",
80
+ " \"cuxfilter-cu12>=24.4.0a0,<=24.4\" \"cucim-cu12>=24.4.0a0,<=24.4\" \\\n",
81
+ " \"pylibraft-cu12>=24.4.0a0,<=24.4\" \"raft-dask-cu12>=24.4.0a0,<=24.4\" \\\n",
82
+ " \"dask-cuda>=24.4.0a0,<=24.4\"\n",
83
+ "!python -m pipx install poetry"
84
  ]
85
  },
86
  {
 
130
  "outputs": [
131
  {
132
  "data": {
133
+ "application/javascript": "if (!(\"Notification\" in window)) {\n alert(\"This browser does not support desktop notifications, so the %%notify magic will not work.\");\n} else if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {\n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission;\n }\n })\n}\n",
 
 
 
 
 
 
 
 
 
 
134
  "text/plain": [
135
  "<IPython.core.display.Javascript object>"
136
  ]
 
550
  "outputs": [
551
  {
552
  "data": {
553
+ "application/javascript": "$(document).ready(\n function() {\n function appendUniqueDiv(){\n // append a div with our uuid so we can check that it's already\n // been sent and avoid duplicates on page reload\n var notifiedDiv = document.createElement(\"div\")\n notifiedDiv.id = \"14ecef73-659b-4bb8-9b20-bdff5827a235\"\n element.append(notifiedDiv)\n }\n\n // only send notifications if the pageload is complete; this will\n // help stop extra notifications when a saved notebook is loaded,\n // which during testing gives us state \"interactive\", not \"complete\"\n if (document.readyState === 'complete') {\n // check for the div that signifies that the notification\n // was already sent\n if (document.getElementById(\"14ecef73-659b-4bb8-9b20-bdff5827a235\") === null) {\n var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n if (Notification.permission !== 'denied') {\n if (Notification.permission !== 'granted') { \n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission\n }\n })\n }\n if (Notification.permission === 'granted') {\n var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n appendUniqueDiv()\n notification.onclick = function () {\n window.focus();\n this.close();\n };\n } \n } \n }\n }\n }\n)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  "text/plain": [
555
  "<IPython.core.display.Javascript object>"
556
  ]
 
1799
  "outputs": [
1800
  {
1801
  "data": {
1802
+ "application/javascript": "$(document).ready(\n function() {\n function appendUniqueDiv(){\n // append a div with our uuid so we can check that it's already\n // been sent and avoid duplicates on page reload\n var notifiedDiv = document.createElement(\"div\")\n notifiedDiv.id = \"c00237ed-2c6a-489c-b1e4-26918a14ad85\"\n element.append(notifiedDiv)\n }\n\n // only send notifications if the pageload is complete; this will\n // help stop extra notifications when a saved notebook is loaded,\n // which during testing gives us state \"interactive\", not \"complete\"\n if (document.readyState === 'complete') {\n // check for the div that signifies that the notification\n // was already sent\n if (document.getElementById(\"c00237ed-2c6a-489c-b1e4-26918a14ad85\") === null) {\n var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n if (Notification.permission !== 'denied') {\n if (Notification.permission !== 'granted') { \n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission\n }\n })\n }\n if (Notification.permission === 'granted') {\n var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n appendUniqueDiv()\n notification.onclick = function () {\n window.focus();\n this.close();\n };\n } \n } \n }\n }\n }\n)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1803
  "text/plain": [
1804
  "<IPython.core.display.Javascript object>"
1805
  ]
 
2339
  },
2340
  {
2341
  "data": {
2342
+ "application/javascript": "$(document).ready(\n function() {\n function appendUniqueDiv(){\n // append a div with our uuid so we can check that it's already\n // been sent and avoid duplicates on page reload\n var notifiedDiv = document.createElement(\"div\")\n notifiedDiv.id = \"c95b16e8-082b-4e2d-a87a-ad40b5a15f5f\"\n element.append(notifiedDiv)\n }\n\n // only send notifications if the pageload is complete; this will\n // help stop extra notifications when a saved notebook is loaded,\n // which during testing gives us state \"interactive\", not \"complete\"\n if (document.readyState === 'complete') {\n // check for the div that signifies that the notification\n // was already sent\n if (document.getElementById(\"c95b16e8-082b-4e2d-a87a-ad40b5a15f5f\") === null) {\n var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n if (Notification.permission !== 'denied') {\n if (Notification.permission !== 'granted') { \n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission\n }\n })\n }\n if (Notification.permission === 'granted') {\n var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n appendUniqueDiv()\n notification.onclick = function () {\n window.focus();\n this.close();\n };\n } \n } \n }\n }\n }\n)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2343
  "text/plain": [
2344
  "<IPython.core.display.Javascript object>"
2345
  ]
 
2423
  },
2424
  {
2425
  "data": {
2426
+ "application/javascript": "$(document).ready(\n function() {\n function appendUniqueDiv(){\n // append a div with our uuid so we can check that it's already\n // been sent and avoid duplicates on page reload\n var notifiedDiv = document.createElement(\"div\")\n notifiedDiv.id = \"b05e6bc3-989f-4f7b-91ec-7d092cf21e12\"\n element.append(notifiedDiv)\n }\n\n // only send notifications if the pageload is complete; this will\n // help stop extra notifications when a saved notebook is loaded,\n // which during testing gives us state \"interactive\", not \"complete\"\n if (document.readyState === 'complete') {\n // check for the div that signifies that the notification\n // was already sent\n if (document.getElementById(\"b05e6bc3-989f-4f7b-91ec-7d092cf21e12\") === null) {\n var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n if (Notification.permission !== 'denied') {\n if (Notification.permission !== 'granted') { \n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission\n }\n })\n }\n if (Notification.permission === 'granted') {\n var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n appendUniqueDiv()\n notification.onclick = function () {\n window.focus();\n this.close();\n };\n } \n } \n }\n }\n }\n)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2427
  "text/plain": [
2428
  "<IPython.core.display.Javascript object>"
2429
  ]
 
3046
  " f.write(json.dumps(str(topic_keyword_weights),indent=4, ensure_ascii=False))"
3047
  ]
3048
  },
3049
+ {
3050
+ "cell_type": "code",
3051
+ "execution_count": null,
3052
+ "id": "598bab35",
3053
+ "metadata": {},
3054
+ "outputs": [],
3055
+ "source": [
3056
+ "# Coherence score\n",
3057
+ "import gensim.corpora as corpora\n",
3058
+ "from gensim.models.coherencemodel import CoherenceModel\n",
3059
+ "\n",
3060
+ "\n",
3061
+ "cleaned_docs = topic_model_booking._preprocess_text(df_documents_booking)\n",
3062
+ "vectorizer = topic_model_booking.vectorizer_model\n",
3063
+ "analyzer = vectorizer.build_analyzer()\n",
3064
+ "tokens = [analyzer(doc) for doc in cleaned_docs]\n",
3065
+ "dictionary = corpora.Dictionary(tokens)\n",
3066
+ "corpus = [dictionary.doc2bow(token) for token in tokens]\n",
3067
+ "topics = topic_model_booking.get_topics()\n",
3068
+ "topics.pop(-1, None)\n",
3069
+ "topic_words = [\n",
3070
+ " [word for word, _ in topic_model_booking.get_topic(topic) if word != \"\"] for topic in topics\n",
3071
+ " ]\n",
3072
+ "# topic_words = [[words for words, _ in topic_model_booking.get_topic(topic)] \n",
3073
+ "# for topic in range(len(set(topics))-1)]\n",
3074
+ "\n",
3075
+ " # Evaluate\n",
3076
+ "coherence_model = CoherenceModel(topics=topic_words, \n",
3077
+ " texts=tokens, \n",
3078
+ " corpus=corpus,\n",
3079
+ " dictionary=dictionary, \n",
3080
+ " coherence='c_npmi')\n",
3081
+ "coherence = coherence_model.get_coherence()\n",
3082
+ "coherence"
3083
+ ]
3084
+ },
3085
  {
3086
  "cell_type": "code",
3087
  "execution_count": 32,
 
7926
  },
7927
  {
7928
  "data": {
7929
+ "application/javascript": "$(document).ready(\n function() {\n function appendUniqueDiv(){\n // append a div with our uuid so we can check that it's already\n // been sent and avoid duplicates on page reload\n var notifiedDiv = document.createElement(\"div\")\n notifiedDiv.id = \"2509d570-7cd9-4cbb-a9f3-9fa5e2d7877a\"\n element.append(notifiedDiv)\n }\n\n // only send notifications if the pageload is complete; this will\n // help stop extra notifications when a saved notebook is loaded,\n // which during testing gives us state \"interactive\", not \"complete\"\n if (document.readyState === 'complete') {\n // check for the div that signifies that the notification\n // was already sent\n if (document.getElementById(\"2509d570-7cd9-4cbb-a9f3-9fa5e2d7877a\") === null) {\n var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n if (Notification.permission !== 'denied') {\n if (Notification.permission !== 'granted') { \n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission\n }\n })\n }\n if (Notification.permission === 'granted') {\n var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n appendUniqueDiv()\n notification.onclick = function () {\n window.focus();\n this.close();\n };\n } \n } \n }\n }\n }\n)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7930
  "text/plain": [
7931
  "<IPython.core.display.Javascript object>"
7932
  ]
 
38532
  },
38533
  {
38534
  "data": {
38535
+ "application/javascript": "$(document).ready(\n function() {\n function appendUniqueDiv(){\n // append a div with our uuid so we can check that it's already\n // been sent and avoid duplicates on page reload\n var notifiedDiv = document.createElement(\"div\")\n notifiedDiv.id = \"6b8a098b-aca8-4f94-802d-46019aed94dc\"\n element.append(notifiedDiv)\n }\n\n // only send notifications if the pageload is complete; this will\n // help stop extra notifications when a saved notebook is loaded,\n // which during testing gives us state \"interactive\", not \"complete\"\n if (document.readyState === 'complete') {\n // check for the div that signifies that the notification\n // was already sent\n if (document.getElementById(\"6b8a098b-aca8-4f94-802d-46019aed94dc\") === null) {\n var notificationPayload = {\"requireInteraction\": false, \"icon\": \"/static/base/images/favicon.ico\", \"body\": \"Cell execution has finished!\"};\n if (Notification.permission !== 'denied') {\n if (Notification.permission !== 'granted') { \n Notification.requestPermission(function (permission) {\n if(!('permission' in Notification)) {\n Notification.permission = permission\n }\n })\n }\n if (Notification.permission === 'granted') {\n var notification = new Notification(\"Jupyter Notebook\", notificationPayload)\n appendUniqueDiv()\n notification.onclick = function () {\n window.focus();\n this.close();\n };\n } \n } \n }\n }\n }\n)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38536
  "text/plain": [
38537
  "<IPython.core.display.Javascript object>"
38538
  ]
 
38627
  "topic_info"
38628
  ]
38629
  },
 
 
 
 
 
 
 
 
 
 
38630
  {
38631
  "cell_type": "code",
38632
  "execution_count": null,
 
38707
  " f.write(json.dumps(str(topic_keyword_weights),indent=4, ensure_ascii=False))"
38708
  ]
38709
  },
38710
+ {
38711
+ "cell_type": "code",
38712
+ "execution_count": null,
38713
+ "id": "a2f833bd",
38714
+ "metadata": {},
38715
+ "outputs": [],
38716
+ "source": [
38717
+ "# Coherence score\n",
38718
+ "import gensim.corpora as corpora\n",
38719
+ "from gensim.models.coherencemodel import CoherenceModel\n",
38720
+ "\n",
38721
+ "\n",
38722
+ "cleaned_docs = topic_model_tripadvisor._preprocess_text(df_documents_tripadvisor)\n",
38723
+ "vectorizer = topic_model_tripadvisor.vectorizer_model\n",
38724
+ "analyzer = vectorizer.build_analyzer()\n",
38725
+ "tokens = [analyzer(doc) for doc in cleaned_docs]\n",
38726
+ "dictionary = corpora.Dictionary(tokens)\n",
38727
+ "corpus = [dictionary.doc2bow(token) for token in tokens]\n",
38728
+ "topics = topic_model_tripadvisor.get_topics()\n",
38729
+ "topics.pop(-1, None)\n",
38730
+ "topic_words = [\n",
38731
+ " [word for word, _ in topic_model_tripadvisor.get_topic(topic) if word != \"\"] for topic in topics\n",
38732
+ " ]\n",
38733
+ "# topic_words = [[words for words, _ in topic_model_booking.get_topic(topic)] \n",
38734
+ "# for topic in range(len(set(topics))-1)]\n",
38735
+ "\n",
38736
+ " # Evaluate\n",
38737
+ "coherence_model = CoherenceModel(topics=topic_words, \n",
38738
+ " texts=tokens, \n",
38739
+ " corpus=corpus,\n",
38740
+ " dictionary=dictionary, \n",
38741
+ " coherence='c_npmi')\n",
38742
+ "coherence = coherence_model.get_coherence()\n",
38743
+ "coherence"
38744
+ ]
38745
+ },
38746
  {
38747
  "cell_type": "code",
38748
  "execution_count": null,