Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

amazon.html 38 KB

You have to be logged in to leave a comment. Sign In
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
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
  3. <meta charset="utf-8">
  4. <meta name="generator" content="quarto-1.3.450">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  6. <title>Book Data Tools – amazon</title>
  7. <style>
  8. code{white-space: pre-wrap;}
  9. span.smallcaps{font-variant: small-caps;}
  10. div.columns{display: flex; gap: min(4vw, 1.5em);}
  11. div.column{flex: auto; overflow-x: auto;}
  12. div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
  13. ul.task-list{list-style: none;}
  14. ul.task-list li input[type="checkbox"] {
  15. width: 0.8em;
  16. margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
  17. vertical-align: middle;
  18. }
  19. /* CSS for syntax highlighting */
  20. pre > code.sourceCode { white-space: pre; position: relative; }
  21. pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
  22. pre > code.sourceCode > span:empty { height: 1.2em; }
  23. .sourceCode { overflow: visible; }
  24. code.sourceCode > span { color: inherit; text-decoration: inherit; }
  25. div.sourceCode { margin: 1em 0; }
  26. pre.sourceCode { margin: 0; }
  27. @media screen {
  28. div.sourceCode { overflow: auto; }
  29. }
  30. @media print {
  31. pre > code.sourceCode { white-space: pre-wrap; }
  32. pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
  33. }
  34. pre.numberSource code
  35. { counter-reset: source-line 0; }
  36. pre.numberSource code > span
  37. { position: relative; left: -4em; counter-increment: source-line; }
  38. pre.numberSource code > span > a:first-child::before
  39. { content: counter(source-line);
  40. position: relative; left: -1em; text-align: right; vertical-align: baseline;
  41. border: none; display: inline-block;
  42. -webkit-touch-callout: none; -webkit-user-select: none;
  43. -khtml-user-select: none; -moz-user-select: none;
  44. -ms-user-select: none; user-select: none;
  45. padding: 0 4px; width: 4em;
  46. }
  47. pre.numberSource { margin-left: 3em; padding-left: 4px; }
  48. div.sourceCode
  49. { }
  50. @media screen {
  51. pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
  52. }
  53. </style>
  54. <script src="../site_libs/quarto-nav/quarto-nav.js"></script>
  55. <script src="../site_libs/quarto-nav/headroom.min.js"></script>
  56. <script src="../site_libs/clipboard/clipboard.min.js"></script>
  57. <script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
  58. <script src="../site_libs/quarto-search/fuse.min.js"></script>
  59. <script src="../site_libs/quarto-search/quarto-search.js"></script>
  60. <meta name="quarto:offset" content="../">
  61. <script src="../site_libs/quarto-html/quarto.js"></script>
  62. <script src="../site_libs/quarto-html/popper.min.js"></script>
  63. <script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
  64. <script src="../site_libs/quarto-html/anchor.min.js"></script>
  65. <link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
  66. <link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles">
  67. <link href="../site_libs/quarto-html/quarto-syntax-highlighting-dark.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles">
  68. <script src="../site_libs/bootstrap/bootstrap.min.js"></script>
  69. <link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
  70. <link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light">
  71. <link href="../site_libs/bootstrap/bootstrap-dark.min.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark">
  72. <script id="quarto-search-options" type="application/json">{
  73. "location": "sidebar",
  74. "copy-button": false,
  75. "collapse-after": 3,
  76. "panel-placement": "start",
  77. "type": "textbox",
  78. "limit": 20,
  79. "language": {
  80. "search-no-results-text": "No results",
  81. "search-matching-documents-text": "matching documents",
  82. "search-copy-link-title": "Copy link to search",
  83. "search-hide-matches-text": "Hide additional matches",
  84. "search-more-match-text": "more match in this document",
  85. "search-more-matches-text": "more matches in this document",
  86. "search-clear-button-title": "Clear",
  87. "search-detached-cancel-button-title": "Cancel",
  88. "search-submit-button-title": "Submit",
  89. "search-label": "Search"
  90. }
  91. }</script>
  92. <link rel="stylesheet" href="../tweaks.css">
  93. </head>
  94. <body class="nav-sidebar floating">
  95. <div id="quarto-search-results"></div>
  96. <header id="quarto-header" class="headroom fixed-top">
  97. <nav class="quarto-secondary-nav">
  98. <div class="container-fluid d-flex">
  99. <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
  100. <i class="bi bi-layout-text-sidebar-reverse"></i>
  101. </button>
  102. <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="../data/index.html">Data Organization</a></li><li class="breadcrumb-item"><a href="../data/amazon.html">Amazon Ratings</a></li></ol></nav>
  103. <a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
  104. </a>
  105. <button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
  106. <i class="bi bi-search"></i>
  107. </button>
  108. </div>
  109. </nav>
  110. </header>
  111. <!-- content -->
  112. <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
  113. <!-- sidebar -->
  114. <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
  115. <div class="pt-lg-2 mt-2 text-left sidebar-header">
  116. <div class="sidebar-title mb-0 py-0">
  117. <a href="../">Book Data Tools</a>
  118. <div class="sidebar-tools-main">
  119. <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a>
  120. </div>
  121. </div>
  122. </div>
  123. <div class="mt-2 flex-shrink-0 align-items-center">
  124. <div class="sidebar-search">
  125. <div id="quarto-search" class="" title="Search"></div>
  126. </div>
  127. </div>
  128. <div class="sidebar-menu-container">
  129. <ul class="list-unstyled mt-1">
  130. <li class="sidebar-item">
  131. <div class="sidebar-item-container">
  132. <a href="../index.html" class="sidebar-item-text sidebar-link">
  133. <span class="menu-text">Overview</span></a>
  134. </div>
  135. </li>
  136. <li class="sidebar-item sidebar-item-section">
  137. <div class="sidebar-item-container">
  138. <a href="../using/index.html" class="sidebar-item-text sidebar-link">
  139. <span class="menu-text">Importing</span></a>
  140. <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
  141. <i class="bi bi-chevron-right ms-2"></i>
  142. </a>
  143. </div>
  144. <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
  145. <li class="sidebar-item">
  146. <div class="sidebar-item-container">
  147. <a href="../using/setup.html" class="sidebar-item-text sidebar-link">
  148. <span class="menu-text">Environment Setup</span></a>
  149. </div>
  150. </li>
  151. <li class="sidebar-item">
  152. <div class="sidebar-item-container">
  153. <a href="../using/storage.html" class="sidebar-item-text sidebar-link">
  154. <span class="menu-text">Data Storage</span></a>
  155. </div>
  156. </li>
  157. <li class="sidebar-item">
  158. <div class="sidebar-item-container">
  159. <a href="../using/sources.html" class="sidebar-item-text sidebar-link">
  160. <span class="menu-text">Source Data</span></a>
  161. </div>
  162. </li>
  163. <li class="sidebar-item">
  164. <div class="sidebar-item-container">
  165. <a href="../using/running.html" class="sidebar-item-text sidebar-link">
  166. <span class="menu-text">Running the Tools</span></a>
  167. </div>
  168. </li>
  169. </ul>
  170. </li>
  171. <li class="sidebar-item sidebar-item-section">
  172. <div class="sidebar-item-container">
  173. <a href="../data/index.html" class="sidebar-item-text sidebar-link">
  174. <span class="menu-text">Data Organization</span></a>
  175. <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="true" aria-label="Toggle section">
  176. <i class="bi bi-chevron-right ms-2"></i>
  177. </a>
  178. </div>
  179. <ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 show">
  180. <li class="sidebar-item">
  181. <div class="sidebar-item-container">
  182. <a href="../data/ids.html" class="sidebar-item-text sidebar-link">
  183. <span class="menu-text">Common Identifiers</span></a>
  184. </div>
  185. </li>
  186. <li class="sidebar-item">
  187. <div class="sidebar-item-container">
  188. <a href="../data/loc.html" class="sidebar-item-text sidebar-link">
  189. <span class="menu-text">Library of Congress</span></a>
  190. </div>
  191. </li>
  192. <li class="sidebar-item">
  193. <div class="sidebar-item-container">
  194. <a href="../data/openlib.html" class="sidebar-item-text sidebar-link">
  195. <span class="menu-text">OpenLibrary</span></a>
  196. </div>
  197. </li>
  198. <li class="sidebar-item">
  199. <div class="sidebar-item-container">
  200. <a href="../data/viaf.html" class="sidebar-item-text sidebar-link">
  201. <span class="menu-text">VIAF</span></a>
  202. </div>
  203. </li>
  204. <li class="sidebar-item">
  205. <div class="sidebar-item-container">
  206. <a href="../data/bx.html" class="sidebar-item-text sidebar-link">
  207. <span class="menu-text">BookCrossing</span></a>
  208. </div>
  209. </li>
  210. <li class="sidebar-item">
  211. <div class="sidebar-item-container">
  212. <a href="../data/amazon.html" class="sidebar-item-text sidebar-link active">
  213. <span class="menu-text">Amazon Ratings</span></a>
  214. </div>
  215. </li>
  216. <li class="sidebar-item">
  217. <div class="sidebar-item-container">
  218. <a href="../data/goodreads.html" class="sidebar-item-text sidebar-link">
  219. <span class="menu-text">GoodReads</span></a>
  220. </div>
  221. </li>
  222. <li class="sidebar-item">
  223. <div class="sidebar-item-container">
  224. <a href="../data/cluster.html" class="sidebar-item-text sidebar-link">
  225. <span class="menu-text">Book Clusters</span></a>
  226. </div>
  227. </li>
  228. <li class="sidebar-item">
  229. <div class="sidebar-item-container">
  230. <a href="../data/gender.html" class="sidebar-item-text sidebar-link">
  231. <span class="menu-text">Book Author Gender</span></a>
  232. </div>
  233. </li>
  234. </ul>
  235. </li>
  236. <li class="sidebar-item sidebar-item-section">
  237. <div class="sidebar-item-container">
  238. <a href="../implementation/index.html" class="sidebar-item-text sidebar-link">
  239. <span class="menu-text">Implementation</span></a>
  240. <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="true" aria-label="Toggle section">
  241. <i class="bi bi-chevron-right ms-2"></i>
  242. </a>
  243. </div>
  244. <ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth1 show">
  245. <li class="sidebar-item">
  246. <div class="sidebar-item-container">
  247. <a href="../implementation/pipeline.html" class="sidebar-item-text sidebar-link">
  248. <span class="menu-text">Pipeline Specification</span></a>
  249. </div>
  250. </li>
  251. <li class="sidebar-item">
  252. <div class="sidebar-item-container">
  253. <a href="../implementation/layout.html" class="sidebar-item-text sidebar-link">
  254. <span class="menu-text">Code Layout</span></a>
  255. </div>
  256. </li>
  257. <li class="sidebar-item">
  258. <div class="sidebar-item-container">
  259. <a href="../implementation/dataset.html" class="sidebar-item-text sidebar-link">
  260. <span class="menu-text">Design for Datasets</span></a>
  261. </div>
  262. </li>
  263. </ul>
  264. </li>
  265. <li class="sidebar-item">
  266. <div class="sidebar-item-container">
  267. <a href="../history.html" class="sidebar-item-text sidebar-link">
  268. <span class="menu-text">History</span></a>
  269. </div>
  270. </li>
  271. <li class="sidebar-item">
  272. <div class="sidebar-item-container">
  273. <a href="../papers.html" class="sidebar-item-text sidebar-link">
  274. <span class="menu-text">Papers Using BookData</span></a>
  275. </div>
  276. </li>
  277. <li class="sidebar-item sidebar-item-section">
  278. <div class="sidebar-item-container">
  279. <a href="../reports/index.html" class="sidebar-item-text sidebar-link">
  280. <span class="menu-text">Reports and Audits</span></a>
  281. <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="true" aria-label="Toggle section">
  282. <i class="bi bi-chevron-right ms-2"></i>
  283. </a>
  284. </div>
  285. <ul id="quarto-sidebar-section-4" class="collapse list-unstyled sidebar-section depth1 show">
  286. <li class="sidebar-item">
  287. <div class="sidebar-item-container">
  288. <a href="../reports/LinkageStats.html" class="sidebar-item-text sidebar-link">
  289. <span class="menu-text">Book Data Linkage Statistics</span></a>
  290. </div>
  291. </li>
  292. <li class="sidebar-item">
  293. <div class="sidebar-item-container">
  294. <a href="../reports/audit-cluster-stats.html" class="sidebar-item-text sidebar-link">
  295. <span class="menu-text">ISBN Cluster Changes</span></a>
  296. </div>
  297. </li>
  298. <li class="sidebar-item">
  299. <div class="sidebar-item-container">
  300. <a href="../reports/audit-gender-changes.html" class="sidebar-item-text sidebar-link">
  301. <span class="menu-text">Cluster Gender Changes</span></a>
  302. </div>
  303. </li>
  304. </ul>
  305. </li>
  306. <li class="sidebar-item">
  307. <div class="sidebar-item-container">
  308. <a href="../apidocs/bookdata/" class="sidebar-item-text sidebar-link"><i class="bi bi-gear-wide" role="img">
  309. </i>
  310. <span class="menu-text">Rust API docs</span></a>
  311. </div>
  312. </li>
  313. <li class="sidebar-item">
  314. <div class="sidebar-item-container">
  315. <a href="https://github.com/PIReTship/bookdata-tools" class="sidebar-item-text sidebar-link"><i class="bi bi-github" role="img">
  316. </i>
  317. <span class="menu-text">GitHub repository</span></a>
  318. </div>
  319. </li>
  320. </ul>
  321. </div>
  322. </nav>
  323. <div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
  324. <!-- margin-sidebar -->
  325. <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
  326. <nav id="TOC" role="doc-toc" class="toc-active">
  327. <h2 id="toc-title">On this page</h2>
  328. <ul>
  329. <li><a href="#amazon-ratings" id="toc-amazon-ratings" class="nav-link active" data-scroll-target="#amazon-ratings">Amazon Ratings</a>
  330. <ul class="collapse">
  331. <li><a href="#configuration" id="toc-configuration" class="nav-link" data-scroll-target="#configuration">Configuration</a></li>
  332. <li><a href="#import-steps" id="toc-import-steps" class="nav-link" data-scroll-target="#import-steps">Import Steps</a></li>
  333. <li><a href="#raw-data" id="toc-raw-data" class="nav-link" data-scroll-target="#raw-data">Raw Data</a></li>
  334. <li><a href="#extracted-rating-tables" id="toc-extracted-rating-tables" class="nav-link" data-scroll-target="#extracted-rating-tables">Extracted Rating Tables</a></li>
  335. </ul></li>
  336. </ul>
  337. <div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/PIReTship/bookdata-tools/edit/main/docs/data/amazon.qmd" class="toc-action">Edit this page</a></p><p><a href="https://github.com/PIReTship/bookdata-tools/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
  338. </div>
  339. <!-- main -->
  340. <main class="content" id="quarto-document-content">
  341. <section id="amazon-ratings" class="level1">
  342. <h1>Amazon Ratings</h1>
  343. <p>This processes two data sets from Julian McAuley’s group at UCSD:</p>
  344. <ul>
  345. <li>The <a href="https://cseweb.ucsd.edu/~jmcauley/datasets/amazon/links.html">2014 Amazon reviews data set</a></li>
  346. <li>The <a href="https://cseweb.ucsd.edu/~jmcauley/datasets/amazon_v2/">2018 Amazon reviews data set</a></li>
  347. </ul>
  348. <p>Each consists of user-provided reviews and ratings for a variety of products.</p>
  349. <p>Currently we import the ratings-only data from the Books segment of the 2014 data set, and the books reviews from the 2018 data set.</p>
  350. <div class="callout callout-style-default callout-important callout-titled">
  351. <div class="callout-header d-flex align-content-center">
  352. <div class="callout-icon-container">
  353. <i class="callout-icon"></i>
  354. </div>
  355. <div class="callout-title-container flex-fill">
  356. Important
  357. </div>
  358. </div>
  359. <div class="callout-body-container callout-body">
  360. <p><strong>If you use this data, cite the paper(s) documented on the data set web site.</strong></p>
  361. <p>For 2014 data, the citations are:</p>
  362. <blockquote class="blockquote">
  363. <p>R. He and J. McAuley. 2016. Ups and downs: Modeling the visual evolution of fashion trends with one-class collaborative filtering. In <cite>Proc. WWW 2016</cite>. DOI:<a href="https://dx.doi.org/10.1145/2872427.2883037">10.1145/2872427.2883037</a>.</p>
  364. </blockquote>
  365. <blockquote class="blockquote">
  366. <p>J. McAuley, C. Targett, J. Shi, and A. van den Hengel. Image-based recommendations on styles and substitutes. In <cite>Proc. SIGIR 2016</cite>. DOI:<a href="http://dx.doi.org/10.1145/2766462.2767755">10.1145/2766462.2767755</a>.</p>
  367. </blockquote>
  368. <p>For 2018 data:</p>
  369. <blockquote class="blockquote">
  370. <p>J. Ni, J. Li, and J. McAuley. Justifying recommendations using distantly-labeled reviews and fined-grained aspects. In <cite>Empirical Methods in Natural Language Processing (EMNLP), 2019</cite>.</p>
  371. </blockquote>
  372. </div>
  373. </div>
  374. <p>Imported data lives in the <code>az2014</code> and <code>az2018</code> directories. The source files are not automatically downloaded — you will need to download the <strong>ratings-only</strong> data for the Books category from each data site and save them in the <code>data/az2014</code> and <code>data/az2018</code> directories.</p>
  375. <section id="configuration" class="level2">
  376. <h2 class="anchored" data-anchor-id="configuration">Configuration</h2>
  377. <p><code>config.yaml</code> allows you to specify whether the review data is used:</p>
  378. <div class="sourceCode" id="cb1"><pre class="sourceCode yaml code-with-copy"><code class="sourceCode yaml"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">az2014</span><span class="kw">:</span></span>
  379. <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">enabled</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
  380. <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span>
  381. <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">az2018</span><span class="kw">:</span></span>
  382. <span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">enabled</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
  383. <span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">source</span><span class="kw">:</span><span class="at"> reviews</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
  384. </section>
  385. <section id="import-steps" class="level2">
  386. <h2 class="anchored" data-anchor-id="import-steps">Import Steps</h2>
  387. <p>The import is controlled by the following DVC steps:</p>
  388. <dl>
  389. <dt><code>scan-ratings</code></dt>
  390. <dd>
  391. Scan the rating CSV file into a Parquet file, converting user strings into numeric IDs. Produces <a href="../data/amazon.html#file:az2014/ratings.parquet"><code>az2014/ratings.parquet</code></a>.
  392. </dd>
  393. <dt><code>cluster-ratings</code></dt>
  394. <dd>
  395. Link ratings with book clusters and aggregate by cluster, to produce user ratings for book clsuters. Produces <a href="../data/amazon.html#file:az2014/az-cluster-ratings.parquet"><code>az2014/az-cluster-ratings.parquet</code></a>.
  396. </dd>
  397. </dl>
  398. </section>
  399. <section id="raw-data" class="level2">
  400. <h2 class="anchored" data-anchor-id="raw-data">Raw Data</h2>
  401. <div id="file:az2014/ratings.parquet" class="parquet file-block" data-file="az2014/ratings.parquet">
  402. <div class="file-header">
  403. <code>az2014/ratings.parquet</code>
  404. </div>
  405. <p>The raw rating data, with user strings converted to numeric IDs, is in this file.</p>
  406. <details class="file-details"><summary>File details</summary>
  407. <table class="file-schema table">
  408. <caption>Schema for <code>az2014/ratings.parquet</code>.</caption>
  409. <colgroup>
  410. <col style="width: 60%">
  411. <col style="width: 40%">
  412. </colgroup>
  413. <thead>
  414. <tr class="header">
  415. <th style="text-align: left;"><div>
  416. Field
  417. </div></th>
  418. <th style="text-align: right;"><div>
  419. Type
  420. </div></th>
  421. </tr>
  422. </thead>
  423. <tbody>
  424. <tr class="odd">
  425. <td style="text-align: left;"><div>
  426. user
  427. </div></td>
  428. <td style="text-align: right;"><div>
  429. Int32
  430. </div></td>
  431. </tr>
  432. <tr class="even">
  433. <td style="text-align: left;"><div>
  434. asin
  435. </div></td>
  436. <td style="text-align: right;"><div>
  437. Utf8
  438. </div></td>
  439. </tr>
  440. <tr class="odd">
  441. <td style="text-align: left;"><div>
  442. rating
  443. </div></td>
  444. <td style="text-align: right;"><div>
  445. Float32
  446. </div></td>
  447. </tr>
  448. <tr class="even">
  449. <td style="text-align: left;"><div>
  450. timestamp
  451. </div></td>
  452. <td style="text-align: right;"><div>
  453. Int64
  454. </div></td>
  455. </tr>
  456. </tbody>
  457. </table>
  458. </details>
  459. </div>
  460. <div id="file:az2018/ratings.parquet" class="parquet file-block" data-file="az2018/ratings.parquet">
  461. <div class="file-header">
  462. <code>az2018/ratings.parquet</code>
  463. </div>
  464. <p>The raw rating data, with user strings converted to numeric IDs, is in this file.</p>
  465. <details class="file-details"><summary>File details</summary>
  466. <table class="file-schema table">
  467. <caption>Schema for <code>az2018/ratings.parquet</code>.</caption>
  468. <colgroup>
  469. <col style="width: 60%">
  470. <col style="width: 40%">
  471. </colgroup>
  472. <thead>
  473. <tr class="header">
  474. <th style="text-align: left;"><div>
  475. Field
  476. </div></th>
  477. <th style="text-align: right;"><div>
  478. Type
  479. </div></th>
  480. </tr>
  481. </thead>
  482. <tbody>
  483. <tr class="odd">
  484. <td style="text-align: left;"><div>
  485. user
  486. </div></td>
  487. <td style="text-align: right;"><div>
  488. Int32
  489. </div></td>
  490. </tr>
  491. <tr class="even">
  492. <td style="text-align: left;"><div>
  493. asin
  494. </div></td>
  495. <td style="text-align: right;"><div>
  496. Utf8
  497. </div></td>
  498. </tr>
  499. <tr class="odd">
  500. <td style="text-align: left;"><div>
  501. rating
  502. </div></td>
  503. <td style="text-align: right;"><div>
  504. Float32
  505. </div></td>
  506. </tr>
  507. <tr class="even">
  508. <td style="text-align: left;"><div>
  509. timestamp
  510. </div></td>
  511. <td style="text-align: right;"><div>
  512. Int64
  513. </div></td>
  514. </tr>
  515. </tbody>
  516. </table>
  517. </details>
  518. </div>
  519. </section>
  520. <section id="extracted-rating-tables" class="level2">
  521. <h2 class="anchored" data-anchor-id="extracted-rating-tables">Extracted Rating Tables</h2>
  522. <div id="file:az2014/az-cluster-ratings.parquet" class="parquet file-block" data-file="az2014/az-cluster-ratings.parquet">
  523. <div class="file-header">
  524. <code>az2014/az-cluster-ratings.parquet</code>
  525. </div>
  526. <p>This file contains the integrated Amazon ratings, with cluster IDs in the <code>item</code> column.</p>
  527. <details class="file-details"><summary>File details</summary>
  528. <table class="file-schema table">
  529. <caption>Schema for <code>az2014/az-cluster-ratings.parquet</code>.</caption>
  530. <colgroup>
  531. <col style="width: 60%">
  532. <col style="width: 40%">
  533. </colgroup>
  534. <thead>
  535. <tr class="header">
  536. <th style="text-align: left;"><div>
  537. Field
  538. </div></th>
  539. <th style="text-align: right;"><div>
  540. Type
  541. </div></th>
  542. </tr>
  543. </thead>
  544. <tbody>
  545. <tr class="odd">
  546. <td style="text-align: left;"><div>
  547. user
  548. </div></td>
  549. <td style="text-align: right;"><div>
  550. Int32
  551. </div></td>
  552. </tr>
  553. <tr class="even">
  554. <td style="text-align: left;"><div>
  555. item
  556. </div></td>
  557. <td style="text-align: right;"><div>
  558. Int32
  559. </div></td>
  560. </tr>
  561. <tr class="odd">
  562. <td style="text-align: left;"><div>
  563. rating
  564. </div></td>
  565. <td style="text-align: right;"><div>
  566. Float32
  567. </div></td>
  568. </tr>
  569. <tr class="even">
  570. <td style="text-align: left;"><div>
  571. last_rating
  572. </div></td>
  573. <td style="text-align: right;"><div>
  574. Float32
  575. </div></td>
  576. </tr>
  577. <tr class="odd">
  578. <td style="text-align: left;"><div>
  579. first_time
  580. </div></td>
  581. <td style="text-align: right;"><div>
  582. Int64
  583. </div></td>
  584. </tr>
  585. <tr class="even">
  586. <td style="text-align: left;"><div>
  587. last_time
  588. </div></td>
  589. <td style="text-align: right;"><div>
  590. Int64
  591. </div></td>
  592. </tr>
  593. <tr class="odd">
  594. <td style="text-align: left;"><div>
  595. nratings
  596. </div></td>
  597. <td style="text-align: right;"><div>
  598. UInt32
  599. </div></td>
  600. </tr>
  601. </tbody>
  602. </table>
  603. </details>
  604. </div>
  605. <div id="file:az2018/az-cluster-ratings.parquet" class="parquet file-block" data-file="az2018/az-cluster-ratings.parquet">
  606. <div class="file-header">
  607. <code>az2018/az-cluster-ratings.parquet</code>
  608. </div>
  609. <p>This file contains the integrated Amazon ratings, with cluster IDs in the <code>item</code> column.</p>
  610. <details class="file-details"><summary>File details</summary>
  611. <table class="file-schema table">
  612. <caption>Schema for <code>az2018/az-cluster-ratings.parquet</code>.</caption>
  613. <colgroup>
  614. <col style="width: 60%">
  615. <col style="width: 40%">
  616. </colgroup>
  617. <thead>
  618. <tr class="header">
  619. <th style="text-align: left;"><div>
  620. Field
  621. </div></th>
  622. <th style="text-align: right;"><div>
  623. Type
  624. </div></th>
  625. </tr>
  626. </thead>
  627. <tbody>
  628. <tr class="odd">
  629. <td style="text-align: left;"><div>
  630. user
  631. </div></td>
  632. <td style="text-align: right;"><div>
  633. Int32
  634. </div></td>
  635. </tr>
  636. <tr class="even">
  637. <td style="text-align: left;"><div>
  638. item
  639. </div></td>
  640. <td style="text-align: right;"><div>
  641. Int32
  642. </div></td>
  643. </tr>
  644. <tr class="odd">
  645. <td style="text-align: left;"><div>
  646. rating
  647. </div></td>
  648. <td style="text-align: right;"><div>
  649. Float32
  650. </div></td>
  651. </tr>
  652. <tr class="even">
  653. <td style="text-align: left;"><div>
  654. last_rating
  655. </div></td>
  656. <td style="text-align: right;"><div>
  657. Float32
  658. </div></td>
  659. </tr>
  660. <tr class="odd">
  661. <td style="text-align: left;"><div>
  662. first_time
  663. </div></td>
  664. <td style="text-align: right;"><div>
  665. Int64
  666. </div></td>
  667. </tr>
  668. <tr class="even">
  669. <td style="text-align: left;"><div>
  670. last_time
  671. </div></td>
  672. <td style="text-align: right;"><div>
  673. Int64
  674. </div></td>
  675. </tr>
  676. <tr class="odd">
  677. <td style="text-align: left;"><div>
  678. nratings
  679. </div></td>
  680. <td style="text-align: right;"><div>
  681. UInt32
  682. </div></td>
  683. </tr>
  684. </tbody>
  685. </table>
  686. </details>
  687. </div>
  688. </section>
  689. </section>
  690. </main> <!-- /main -->
  691. <script id="quarto-html-after-body" type="application/javascript">
  692. window.document.addEventListener("DOMContentLoaded", function (event) {
  693. const toggleBodyColorMode = (bsSheetEl) => {
  694. const mode = bsSheetEl.getAttribute("data-mode");
  695. const bodyEl = window.document.querySelector("body");
  696. if (mode === "dark") {
  697. bodyEl.classList.add("quarto-dark");
  698. bodyEl.classList.remove("quarto-light");
  699. } else {
  700. bodyEl.classList.add("quarto-light");
  701. bodyEl.classList.remove("quarto-dark");
  702. }
  703. }
  704. const toggleBodyColorPrimary = () => {
  705. const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
  706. if (bsSheetEl) {
  707. toggleBodyColorMode(bsSheetEl);
  708. }
  709. }
  710. toggleBodyColorPrimary();
  711. const disableStylesheet = (stylesheets) => {
  712. for (let i=0; i < stylesheets.length; i++) {
  713. const stylesheet = stylesheets[i];
  714. stylesheet.rel = 'prefetch';
  715. }
  716. }
  717. const enableStylesheet = (stylesheets) => {
  718. for (let i=0; i < stylesheets.length; i++) {
  719. const stylesheet = stylesheets[i];
  720. stylesheet.rel = 'stylesheet';
  721. }
  722. }
  723. const manageTransitions = (selector, allowTransitions) => {
  724. const els = window.document.querySelectorAll(selector);
  725. for (let i=0; i < els.length; i++) {
  726. const el = els[i];
  727. if (allowTransitions) {
  728. el.classList.remove('notransition');
  729. } else {
  730. el.classList.add('notransition');
  731. }
  732. }
  733. }
  734. const toggleColorMode = (alternate) => {
  735. // Switch the stylesheets
  736. const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate');
  737. manageTransitions('#quarto-margin-sidebar .nav-link', false);
  738. if (alternate) {
  739. enableStylesheet(alternateStylesheets);
  740. for (const sheetNode of alternateStylesheets) {
  741. if (sheetNode.id === "quarto-bootstrap") {
  742. toggleBodyColorMode(sheetNode);
  743. }
  744. }
  745. } else {
  746. disableStylesheet(alternateStylesheets);
  747. toggleBodyColorPrimary();
  748. }
  749. manageTransitions('#quarto-margin-sidebar .nav-link', true);
  750. // Switch the toggles
  751. const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle');
  752. for (let i=0; i < toggles.length; i++) {
  753. const toggle = toggles[i];
  754. if (toggle) {
  755. if (alternate) {
  756. toggle.classList.add("alternate");
  757. } else {
  758. toggle.classList.remove("alternate");
  759. }
  760. }
  761. }
  762. // Hack to workaround the fact that safari doesn't
  763. // properly recolor the scrollbar when toggling (#1455)
  764. if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) {
  765. manageTransitions("body", false);
  766. window.scrollTo(0, 1);
  767. setTimeout(() => {
  768. window.scrollTo(0, 0);
  769. manageTransitions("body", true);
  770. }, 40);
  771. }
  772. }
  773. const isFileUrl = () => {
  774. return window.location.protocol === 'file:';
  775. }
  776. const hasAlternateSentinel = () => {
  777. let styleSentinel = getColorSchemeSentinel();
  778. if (styleSentinel !== null) {
  779. return styleSentinel === "alternate";
  780. } else {
  781. return false;
  782. }
  783. }
  784. const setStyleSentinel = (alternate) => {
  785. const value = alternate ? "alternate" : "default";
  786. if (!isFileUrl()) {
  787. window.localStorage.setItem("quarto-color-scheme", value);
  788. } else {
  789. localAlternateSentinel = value;
  790. }
  791. }
  792. const getColorSchemeSentinel = () => {
  793. if (!isFileUrl()) {
  794. const storageValue = window.localStorage.getItem("quarto-color-scheme");
  795. return storageValue != null ? storageValue : localAlternateSentinel;
  796. } else {
  797. return localAlternateSentinel;
  798. }
  799. }
  800. let localAlternateSentinel = 'default';
  801. // Dark / light mode switch
  802. window.quartoToggleColorScheme = () => {
  803. // Read the current dark / light value
  804. let toAlternate = !hasAlternateSentinel();
  805. toggleColorMode(toAlternate);
  806. setStyleSentinel(toAlternate);
  807. };
  808. // Ensure there is a toggle, if there isn't float one in the top right
  809. if (window.document.querySelector('.quarto-color-scheme-toggle') === null) {
  810. const a = window.document.createElement('a');
  811. a.classList.add('top-right');
  812. a.classList.add('quarto-color-scheme-toggle');
  813. a.href = "";
  814. a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; };
  815. const i = window.document.createElement("i");
  816. i.classList.add('bi');
  817. a.appendChild(i);
  818. window.document.body.appendChild(a);
  819. }
  820. // Switch to dark mode if need be
  821. if (hasAlternateSentinel()) {
  822. toggleColorMode(true);
  823. } else {
  824. toggleColorMode(false);
  825. }
  826. const icon = "";
  827. const anchorJS = new window.AnchorJS();
  828. anchorJS.options = {
  829. placement: 'right',
  830. icon: icon
  831. };
  832. anchorJS.add('.anchored');
  833. const isCodeAnnotation = (el) => {
  834. for (const clz of el.classList) {
  835. if (clz.startsWith('code-annotation-')) {
  836. return true;
  837. }
  838. }
  839. return false;
  840. }
  841. const clipboard = new window.ClipboardJS('.code-copy-button', {
  842. text: function(trigger) {
  843. const codeEl = trigger.previousElementSibling.cloneNode(true);
  844. for (const childEl of codeEl.children) {
  845. if (isCodeAnnotation(childEl)) {
  846. childEl.remove();
  847. }
  848. }
  849. return codeEl.innerText;
  850. }
  851. });
  852. clipboard.on('success', function(e) {
  853. // button target
  854. const button = e.trigger;
  855. // don't keep focus
  856. button.blur();
  857. // flash "checked"
  858. button.classList.add('code-copy-button-checked');
  859. var currentTitle = button.getAttribute("title");
  860. button.setAttribute("title", "Copied!");
  861. let tooltip;
  862. if (window.bootstrap) {
  863. button.setAttribute("data-bs-toggle", "tooltip");
  864. button.setAttribute("data-bs-placement", "left");
  865. button.setAttribute("data-bs-title", "Copied!");
  866. tooltip = new bootstrap.Tooltip(button,
  867. { trigger: "manual",
  868. customClass: "code-copy-button-tooltip",
  869. offset: [0, -8]});
  870. tooltip.show();
  871. }
  872. setTimeout(function() {
  873. if (tooltip) {
  874. tooltip.hide();
  875. button.removeAttribute("data-bs-title");
  876. button.removeAttribute("data-bs-toggle");
  877. button.removeAttribute("data-bs-placement");
  878. }
  879. button.setAttribute("title", currentTitle);
  880. button.classList.remove('code-copy-button-checked');
  881. }, 1000);
  882. // clear code selection
  883. e.clearSelection();
  884. });
  885. function tippyHover(el, contentFn) {
  886. const config = {
  887. allowHTML: true,
  888. content: contentFn,
  889. maxWidth: 500,
  890. delay: 100,
  891. arrow: false,
  892. appendTo: function(el) {
  893. return el.parentElement;
  894. },
  895. interactive: true,
  896. interactiveBorder: 10,
  897. theme: 'quarto',
  898. placement: 'bottom-start'
  899. };
  900. window.tippy(el, config);
  901. }
  902. const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
  903. for (var i=0; i<noterefs.length; i++) {
  904. const ref = noterefs[i];
  905. tippyHover(ref, function() {
  906. // use id or data attribute instead here
  907. let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
  908. try { href = new URL(href).hash; } catch {}
  909. const id = href.replace(/^#\/?/, "");
  910. const note = window.document.getElementById(id);
  911. return note.innerHTML;
  912. });
  913. }
  914. let selectedAnnoteEl;
  915. const selectorForAnnotation = ( cell, annotation) => {
  916. let cellAttr = 'data-code-cell="' + cell + '"';
  917. let lineAttr = 'data-code-annotation="' + annotation + '"';
  918. const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
  919. return selector;
  920. }
  921. const selectCodeLines = (annoteEl) => {
  922. const doc = window.document;
  923. const targetCell = annoteEl.getAttribute("data-target-cell");
  924. const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
  925. const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
  926. const lines = annoteSpan.getAttribute("data-code-lines").split(",");
  927. const lineIds = lines.map((line) => {
  928. return targetCell + "-" + line;
  929. })
  930. let top = null;
  931. let height = null;
  932. let parent = null;
  933. if (lineIds.length > 0) {
  934. //compute the position of the single el (top and bottom and make a div)
  935. const el = window.document.getElementById(lineIds[0]);
  936. top = el.offsetTop;
  937. height = el.offsetHeight;
  938. parent = el.parentElement.parentElement;
  939. if (lineIds.length > 1) {
  940. const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
  941. const bottom = lastEl.offsetTop + lastEl.offsetHeight;
  942. height = bottom - top;
  943. }
  944. if (top !== null && height !== null && parent !== null) {
  945. // cook up a div (if necessary) and position it
  946. let div = window.document.getElementById("code-annotation-line-highlight");
  947. if (div === null) {
  948. div = window.document.createElement("div");
  949. div.setAttribute("id", "code-annotation-line-highlight");
  950. div.style.position = 'absolute';
  951. parent.appendChild(div);
  952. }
  953. div.style.top = top - 2 + "px";
  954. div.style.height = height + 4 + "px";
  955. let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
  956. if (gutterDiv === null) {
  957. gutterDiv = window.document.createElement("div");
  958. gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
  959. gutterDiv.style.position = 'absolute';
  960. const codeCell = window.document.getElementById(targetCell);
  961. const gutter = codeCell.querySelector('.code-annotation-gutter');
  962. gutter.appendChild(gutterDiv);
  963. }
  964. gutterDiv.style.top = top - 2 + "px";
  965. gutterDiv.style.height = height + 4 + "px";
  966. }
  967. selectedAnnoteEl = annoteEl;
  968. }
  969. };
  970. const unselectCodeLines = () => {
  971. const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
  972. elementsIds.forEach((elId) => {
  973. const div = window.document.getElementById(elId);
  974. if (div) {
  975. div.remove();
  976. }
  977. });
  978. selectedAnnoteEl = undefined;
  979. };
  980. // Attach click handler to the DT
  981. const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
  982. for (const annoteDlNode of annoteDls) {
  983. annoteDlNode.addEventListener('click', (event) => {
  984. const clickedEl = event.target;
  985. if (clickedEl !== selectedAnnoteEl) {
  986. unselectCodeLines();
  987. const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
  988. if (activeEl) {
  989. activeEl.classList.remove('code-annotation-active');
  990. }
  991. selectCodeLines(clickedEl);
  992. clickedEl.classList.add('code-annotation-active');
  993. } else {
  994. // Unselect the line
  995. unselectCodeLines();
  996. clickedEl.classList.remove('code-annotation-active');
  997. }
  998. });
  999. }
  1000. const findCites = (el) => {
  1001. const parentEl = el.parentElement;
  1002. if (parentEl) {
  1003. const cites = parentEl.dataset.cites;
  1004. if (cites) {
  1005. return {
  1006. el,
  1007. cites: cites.split(' ')
  1008. };
  1009. } else {
  1010. return findCites(el.parentElement)
  1011. }
  1012. } else {
  1013. return undefined;
  1014. }
  1015. };
  1016. var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
  1017. for (var i=0; i<bibliorefs.length; i++) {
  1018. const ref = bibliorefs[i];
  1019. const citeInfo = findCites(ref);
  1020. if (citeInfo) {
  1021. tippyHover(citeInfo.el, function() {
  1022. var popup = window.document.createElement('div');
  1023. citeInfo.cites.forEach(function(cite) {
  1024. var citeDiv = window.document.createElement('div');
  1025. citeDiv.classList.add('hanging-indent');
  1026. citeDiv.classList.add('csl-entry');
  1027. var biblioDiv = window.document.getElementById('ref-' + cite);
  1028. if (biblioDiv) {
  1029. citeDiv.innerHTML = biblioDiv.innerHTML;
  1030. }
  1031. popup.appendChild(citeDiv);
  1032. });
  1033. return popup.innerHTML;
  1034. });
  1035. }
  1036. }
  1037. });
  1038. </script>
  1039. </div> <!-- /content -->
  1040. <script data-goatcounter="https://piret-bookdata.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
  1041. </body></html>
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...