-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArXivExplore.wl
2399 lines (1512 loc) · 104 KB
/
ArXivExplore.wl
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
(* ::Package:: *)
(* ::Section:: *)
(*0. Package Header*)
(* ::Subsection:: *)
(*Begin Package*)
BeginPackage["DanieleGregori`ArXivExplore`"];
(*BeginPackage["My`ArXivExplore`"];*)
(* ::Subsection::Closed:: *)
(*Main database*)
ArXivDataset::usage = "ArXivDataset[All] returns the whole ArXiv dataset cleaned and ordered by date of first version;
ArXivDataset[cat] returns only the dataset for a specified primary category 'cat';
ArXivDataset[[cat,All}] returns the dataset of all articles sharing (as primary or as cross-list) the cateory 'cat'.";
(*Notice: in the present version all datasets are updated up to June 2024.*)
ArXivDatasetLookup::usage =
"ArXivDatasetLookup[key] returns all the specified values for the key 'key' of the whole ArXiv dataset;
ArXivDatasetLookup[key,subdataset_List] returns all the specified keys of a certain subdataset;
ArXivDatasetLookup[key,cat_String] returns all the specified keys of a the specified primary category 'cat';
ArXivDatasetLookup[key,{cat_String,All}] returns all the specified keys of a the specified primary or cross-list category 'cat'";
ArXivDatasetAggregate::usage =
"ArXivDatasetAggregate[prefix_String] aggregates all primary categories with a given prefix;
ArXivDatasetAggregate[{prefix_String,All}] aggregates all primary or cross-list categories with a given prefix.";
ArXivDatasetSubset::usage =
"ArXivDatasetSubset[idL_List] allow to create a custom dataset with the given article id list 'idL'.";
arXivDatasetKeys::usage = "arXivDatasetKeys returns all possible database keys";
(* ::Subsection::Closed:: *)
(*Categories*)
ArXivCategories::usage =
"ArXivCategories[id] returns all the categories of a given id, searching in the whole ArXiv dataset;
ArXivCategories[id,cat] returns all the categories of a given id, from the ArXiv subdataset of the given category;
ArXivCategories[All,cat] returns all categories of a given category 'cat', associated with their id.";
ArXivCategoriesPrimary::usage =
"ArXivCategoriesPrimary[id] returns all primary categories of a given id, searching in the whole ArXiv dataset;
ArXivCategoriesPrimary[id,cat] returns all primary categories of a given id, from the ArXiv subdataset of the given category;
ArXivCategoriesPrimary[All,cat] returns all primary categories of a given category 'cat', associated with their id.";
ArXivTopCategories::usage =
"ArXivTopCategories[All] returns the ranking of all primary categories, in terms of their corresponding total articles;
ArXivTopCategories[cut] returns only the first 'cut' most frequent primary categories, with the number of corresponding articles.";
ArXivCategoriesLegend::usage = "ArXivCategoriesLegend[cat_String] associates each primary category name with its fulldescription.";
arXivCategoriesUnion::usage = "arXivCategoriesUnion returns all possible categories";
(*arXivCategoriesAssoc;*)
(* ::Subsection::Closed:: *)
(*T EX scraping*)
ArXivTeXDocument::usage = "ArXivTeXDocument[id] scrapes the TeX source of a given article id.";
ArXivTeXSections::usage = "ArXivTeXSections[id] scrapes from the TeX source the sections of a given article id.";
ArXivTeXIntroduction::usage = "ArXivTeXIntroduction[id] scrapes from the TeX source the introduction section of a given article id.";
(*arXivTeXBeginEnd;*)
(*arXivTeXPartVisualize;*)
ArXivTeXFormulae::usage =
"ArXivTeXFormulae[tex] scrapes from source TeX 'tex' all formulae and returns an association with each type;
ArXivTeXFormulae[tex,wordeq] scrapes from source TeX 'tex' the formulae only of a given type 'wordeq'.";
(* ::Subsection::Closed:: *)
(*Citations*)
ArXivCitationsTotal::usage =
"ArXivCitationsTotal[id_String] returns the total citations of a given article id;
ArXivCitationsTotal[idL_List] returns the total citations of a each article of the id list 'idL'.";
ArXivCitations::usage =
"ArXivCitations[id_String] returns all ids of articles citing a given article id;
ArXivCitations[idL_List] returns all ids of articles citing each article of the id list 'idL'.";
ArXivCitationsAuthor::usage =
"ArXivCitationsAuthor[author] returns all pairs of ids of which the first is an article of a given author - on all ArXiv - and the last is another paper that cites it;
ArXivCitationsAuthor[author,cat] returns all pairs of ids of which the first is an article of a given author - in category 'cat' - and the last is another paper that cites it;
ArXivCitationsAuthor[authorL_List,cat] returns all pairs of ids of which the first is an article of a given list of authors 'authorL' - in category 'cat' - and the last is another paper that cites it;
ArXivCitationsAuthor[authorL_List,catL_List] returns all pairs of ids of which the first is an article of a given the two lists 'doubleL' - the first made of author names and the second of corresponding categories - and the last is another paper that cites it.";
ArXivGraphAuthor::usage =
"ArXivGraphAuthor[author_String,cat_] returns a citation graph of a given author in a given category 'cat';
ArXivGraphAuthor[authorL_List,cat_] returns a citation graph of a given author list 'authorL' in a given category 'cat';
ArXivGraphAuthor[authorL_List,catL_List] returns a citation graph of a given the two lists 'doubleL' - the first made of author names and the second of corresponding categories.";
ArXivGraph::usage =
"ArXivGraph[id_String] returns a citation graph of the given article id;
ArXivGraph[idL_List] returns a citation graph of the given article id list 'idL'.";
(*
ArXivGraph[idL_List,n_Integer] returns a citation graph of the given article id list 'idL', iterated 'n' times.*)
(* ::Subsection:: *)
(*Main data*)
(* ::Subsubsection::Closed:: *)
(*Articles*)
ArXivArticles::usage = "ArXivArticles[id] returns all article dataset items of a given article id or list of ids.";
(* ::Subsubsection::Closed:: *)
(*IDs*)
ArXivIDs::usage =
"ArXivIDs[All] returns all article ids on ArXiv;
ArXivIDs[cat_String] returns all article ids of a given primary category 'cat' on ArXiv;
ArXivIDs[{cat_String,All}] returns all article ids of a given primary or cross-list category 'cat' on ArXiv.";
(* ::Subsubsection::Closed:: *)
(*Titles*)
ArXivTitles::usage =
"ArXivTitles[id] returns all the titles of a given article id;
ArXivTitles[All,cat] returns all titles of a given category 'cat', associated with their id.";
(* ::Subsubsection::Closed:: *)
(*Abstracts*)
ArXivAbstracts::usage =
"ArXivAbstracts[id] returns all the abstracts of a given article id;
ArXivAbstracts[All,cat] returns all abstracts of a given category 'cat', associated with their id.";
(* ::Subsubsection::Closed:: *)
(*Versions*)
ArXivVersions::usage =
"ArXivVersions[id] returns all the versions of a given article id, searching in the whole ArXiv dataset;
ArXivVersions[All] returns all versions on all ArXiv, associated with their id;
ArXivVersions[id,cat] returns all the versions of a given article id, from the ArXiv subdataset of the given category;
ArXivVersions[All,cat] returns all versions of a given category 'cat', associated with their id.";
(*arXivVersionsID::usage=
"arXivVersionsID[All] returns all versions on all ArXiv, associated with their id;
arXivVersionsID[cat] returns all versions of a given category 'cat', associated with their id.";*)
arXivVersionsFirstID::usage =
"arXivVersionsFirstID[All] returns all first versions dates on all ArXiv, associated with their id;
arXivVersionsFirstID[cat] returns all first versions dates of a given category 'cat', associated with their id.";
ArXivDates::usage =
"ArXivDates[All] returns all first versions dates on all ArXiv, associated with their id;
ArXivDates[cat] returns all first versions dates on all ArXiv, associated with their id;
ArXivDates[All,cat,int] returns an association between all article ids of a given category 'cat' and their dates in time resolution 'int'.";
(*ArXivVersions::usage = "ArXivVersions[category] returns all article versions of a given primary category.";*)
(*ArXivVersionFirstDate::usage = "ArXivVersionFirstDate[idmcategory] returns the first article versions of a given id in a given primary category.";*)
(* ::Subsubsection::Closed:: *)
(*Authors*)
(*double author list to fix*)
ArXivAuthors::usage =
"ArXivAuthors[id] returns the authors (appropriately cleaned) of a given article id, searching on all ArXiv;
ArXivAuthors[id,cat] returns the authors (appropriately cleaned) of a given article id, searching only in the category 'cat';
ArXivAuthors[All,cat] returns all authors (appropriately cleaned) of a given category.";
ArXivTopAuthors::usage =
"ArXivTopAuthors[All,n] returns all most prolific authors on all ArXiv, with more than 'n' papers;
ArXivTopAuthors[cat,n] returns all most prolific authors in a given category 'cat', with more than 'n' papers.";
ArXivArticlesAuthor::usage =
"ArXivArticlesAuthor[author_String] returns all articles of a given author, searching on all ArXiv;
ArXivArticlesAuthor[author_String,cat] returns all articles of a given author, searching only in a given category 'cat';
ArXivArticlesAuthor[authorL_List,cat] returns all articles of a given author, with possible names given as a list 'authorL', searching only in a given category 'cat';
ArXivArticlesAuthor[author_String,cat] returns all articles of a given author searching in all categories of the list 'catL';
ArXivArticlesAuthor[authorL_List,catL_List] returns all articles of a given author, with possible names given as a list 'authorL', searching in each category of the list 'catL'.";
(* ::Subsection:: *)
(*Word statistics*)
(* ::Subsubsection::Closed:: *)
(*Total*)
(*to improve*)
ArXivArticlesTrend::usage =
"ArXivArticlesTrend[cat,int] returns an association with the total new articles submissions in the category 'cat' for each time period of resolution 'int'.";
(*ArXivArticlesCount::usage =
"ArXivArticlesCount[All,int] returns a TimeSeries of a given resolution 'int', counting all new articles submissions on all ArXiv;
ArXivArticlesCount[cat,int] returns a TimeSeries of a given resolution 'int', counting all new articles submissions in the category 'cat'.";*)
(* ::Subsubsection::Closed:: *)
(*Cleaned titles/abstracts*)
arXivTitlesCleanID::usage =
"arXivTitlesCleanID[cat] returns an association between all cleaned titles in a given category 'cat' associated and their respective ids.";
arXivTitlesCleanDated::usage =
"arXivTitlesCleanDated[cat,int] returns an association between all cleaned titles in a given category 'cat' associated and their respective dates.";
arXivAbstractsCleanID::usage =
"arXivAbstractsCleanID[cat] returns an association between all cleaned abstracts in a given category 'cat' associated and their respective ids.";
arXivAbstractsCleanDated::usage =
"arXivAbstractsCleanDated[cat,int] returns an association between all cleaned abstracts in a given category 'cat' associated and their respective dates.";
(* ::Subsubsection::Closed:: *)
(*Single words*)
arXivTitlesWordID::usage =
"arXivTitlesWordID[cat_,word_String] returns all cleaned titles in which a 'word' appears, associated with their article ids";
arXivAbstractsWordID::usage =
"arXivAbstractsWordID[cat_,word_String] returns all cleaned abstracts in which a 'word' appears, associated with their article ids";
arXivTitlesWordDated::usage =
"arXivTitlesWordDated[cat_,word_String] returns all cleaned titles in which a 'word' appears, associated with their dates";
arXivAbstractsWordDated::usage =
"arXivAbstractsWordDated[cat_,word_String] returns all cleaned abstracts in which a 'word' appears, associated with their dates";
arXivTitlesWordTrend::usage=
"arXivTitlesWordTrend[cat,word_String,int_:\"Month\"] returns all total title words 'word', associated with their dates of time resolutions 'int'.";
arXivAbstractsWordTrend::usage=
"arXivAbstractsWordTrend[cat,word_String,int_:\"Month\"] returns all total abstract words 'word', associated with their dates of time resolutions 'int'.";
(* ::Subsubsection::Closed:: *)
(*Neighbour words*)
arXivTitlesWordNeighboursID::usage =
"arXivTitlesWordNeighboursID[cat,n_Integer:2] returns all 'n'-neighbour words in cleaned titles of a given category 'cat', as an association with their ids;
arXivTitlesWordNeighboursID[cat,wordNeigh_String] returns all cleaned titles where the word neighbour combination 'wordNeigh' appears, in a given category 'cat', as an association with their ids.";
arXivTitlesWordNeighboursDated::usage=
"arXivTitlesWordNeighboursDated[cat,n_Integer,int_:\"Month\"] returns all 'n'-neighbour words in cleaned titles of a given category 'cat', as an association with its date strings of resolution 'int'.";
ArXivTitlesWordNeighboursTop::usage=
"ArXivTitlesWordNeighboursTop[cat,n_Integer:2,cut_Integer] returns all most frequent ever 'n'-neighbour words in cleaned titles of a given category 'cat', up to a cut-off 'cut'.";
arXivAbstractsWordNeighboursID::usage =
"arXivAbstractsWordNeighboursID[cat,n_Integer:2] returns all 'n'-neighbour words in cleaned abstracts of a given category 'cat', as an association with their ids.";
arXivAbstractsWordNeighboursDated::usage=
"arXivAbstractsWordNeighboursDated[cat,n_Integer,int_:\"Month\"] returns all 'n'-neighbour words in cleaned abstracts of a given category 'cat', as an association with its dates of resolution 'int'.";
ArXivAbstractsWordNeighboursTop::usage=
"ArXivAbstractsWordNeighboursTop[cat,n_Integer:2,cut_Integer:100] returns all most frequent ever 'n'-neighbour words in cleaned abstracts of a given category 'cat', up to a cut-off 'cut'.";
arXivTitlesWordNeighboursTrend::usage =
"arXivTitlesWordNeighboursTrend[cat,n_Integer:2,cut_Integer:10000,int_:\"Month\"] returns all most frequent 'n'-neighbour words in cleaned titles of a given category 'cat', as an association with its dates of resolution 'int', up to a cut-off 'cut';
arXivTitlesWordNeighboursTrend[cat,wordNeigh_String,cut_Integer:10000,int:\"Month\"] returns all total occurences of neighbour words 'wordNeigh' in titles of a given category 'cat', as an association with its dates of resolution 'int', using a cut-off 'cut'.";
arXivAbstractsWordNeighboursTrend::usage =
"arXivAbstractsWordNeighboursTrend[cat,n_Integer:2,cut_Integer:100,int_:\"Month\"] returns all most frequent 'n'-neighbour words in cleaned abstracts of a given category 'cat', as an association with its dates of resolution 'int', up to a cut-off 'cut';
arXivAbstractsWordNeighboursTrend[cat,wordNeigh_String,cut_Integer:100,int_:\"Month\"] all total occurences of neighbour words 'wordNeigh' in abstracts of a given category 'cat', as an association with its dates of resolution 'int', using a cut-off 'cut'.";
(* ::Subsubsection::Closed:: *)
(*Combinations words*)
arXivTitlesWordCombinationID::usage =
"arXivTitlesWordCombinationID[cat,wordComb_And,int_:\"Month\"] returns all cleaned titles where the combination of words 'wordComb' appears, associated with their article ids.";
arXivAbstractsWordCombinationID::usage =
"arXivAbstractsWordCombinationID[cat,wordComb_And,int_:\"Month\"] returns all cleaned abstracts where the combination of words 'wordComb' appears, associated with their article ids.";
arXivTitlesWordCombinationDated::usage =
"arXivTitlesWordCombinationDated[cat,wordComb_And,int_:\"Month\"] returns all cleaned titles where the combination of words 'wordComb' appears, associated with their dates of time resolutions 'int'.";
arXivAbstractsWordCombinationDated::usage =
"arXivAbstractsWordCombinationDated[cat,wordComb_And,int_:\"Month\"] returns all cleaned abstracts where the combination of words 'wordComb' appears, associated with their dates of time resolutions 'int'.";
arXivTitlesWordCombinationTrend::usage =
"arXivTitlesWordCombinationTrend[cat,wordComb_And,int_:\"Month\"] returns all total combinations of title words 'wordComb', associated with their dates of time resolutions 'int'.";
arXivAbstractsWordCombinationTrend::usage =
"arXivAbstractsWordCombinationTrend[cat,wordComb_And,int_:\"Month\"] returns all total combinations of abstract words 'wordComb', associated with their dates of time resolutions 'int'.";
(* ::Subsubsection::Closed:: *)
(*Top and search*)
ArXivTopTitles::usage =
"ArXivTopTitles[cat,cutoff] returns all 'cutoff' most frequent title words, with their number of occurrences, in a given category 'cat';
ArXivTopTitles[cat,cutoff,n] returns all 'cutoff' most frequent title 'n'-words neighbours, with their number of occurrences, in a given category 'cat'.";
ArXivTopAbstracts::usage =
"ArXivTopAbstracts[cat,cutoff] returns all 'cutoff' most frequent abstract words, with their number of occurrences, in a given category 'cat';
ArXivTopAbstracts[cat,cutoff,n] returns all 'cutoff' most frequent abstract 'n'-words neighbours, with their number of occurrences, in a given category 'cat'.";
(*combinations to add*)
arXivTitlesWordSearch::usage =
"arXivTitlesWordSearch[word,cat] returns the ranking of the word among all most popular title words in a given category 'cat', with also its number of occurences.";
arXivAbstractsWordSearch::usage =
"arXivAbstractsWordSearch[word,cat] returns the ranking of the word among all most popular abstract words in a given category 'cat', with also its number of occurences.";
arXivTitlesWordNeighboursSearch::usage =
"arXivTitlesWordNeighboursSearch[wordNeigh,cat] returns the ranking of the word neighbours 'wordNeigh' among all most popular title words in a given category 'cat', with also its number of occurences.";
arXivAbstractsWordNeighboursSearch::usage =
"arXivAbstractsWordNeighboursSearch[word,cat] returns the ranking of the word neighbours 'wordNeigh' among all most popular abstract words in a given category 'cat', with also its number of occurences.";
(* ::Subsubsection::Closed:: *)
(*Word citations*)
(*ArXivTitlesWordCitationTrend::usage =
"ArXivTitlesWordCitationTrend[cat_,word_,int_:\"Month\"] returns a list of rules with the total citations every time period 'int' (with date as string) of every article in category 'cat' having in the (cleaned) title a given word.";*)
(*arXivTitlesWordCitationID::usage=
"arXivTitlesWordCitationID[cat,word] returns all total citations of all articles containing a certain 'word', in category 'cat', associated with their ids.";*)
(*arXivTitlesWordNeighboursCitationID::usage=
"arXivTitlesWordNeighboursCitationID[cat,wordNeigh] returns all total citations of all articles containing a certain word neighbour 'wordNeigh', in category 'cat', associated with their ids.";*)
ArXivCitationsTitles::usage=
"ArXivCitationsTitles[cat,word] returns all total citations of all articles containing a certain word or word neighbour 'word', in category 'cat', associated with their ids.";
(* ::Subsubsection::Closed:: *)
(*WordCloud video (to update)*)
(*below to update*)
(*ArXivTitlesWordCloudVideo::usage =
"ArXivTitlesWordCloudVideo[cat,int_:\"Month\"] creates a video of wordclouds of title words in a given category 'cat', over all time with resolution 'int'.";*)
(* ::Subsection::Closed:: *)
(*ArXivLogos*)
ArXivLogosTitles::usage =
"ArXivLogosTitles[word_String,cat] returns all titles in category 'cat' containing the word 'word', associated with their article id or date;
ArXivLogosTitles[wordAnd_And,cat] returns all titles in category 'cat' containing the word conjuction (And) 'wordAnd', associated with their article id or date;
ArXivLogosTitles[wordOr_Or,cat] returns all titles in category 'cat' containing the word inclusive disjunction (Or) 'wordOr', associated with their article id or date;
ArXivLogosTitles[wordXor_Xor,cat] returns all titles in category 'cat' containing the word exclusive disjunction (Xor) 'wordXor', associated with their article id or date.";
ArXivLogosAbstracts::usage =
"ArXivLogosAbstracts[word_String,cat] returns all abstracts in category 'cat' containing the word 'word', associated with their article id or date;
ArXivLogosAbstracts[wordAnd_And,cat] returns all abstracts in category 'cat' containing the word conjuction (And) 'wordAnd', associated with their article id or date;
ArXivLogosAbstracts[wordOr_Or,cat] returns all abstracts in category 'cat' containing the word inclusive disjunction (Or) 'wordOr', associated with their article id or date;
ArXivLogosAbstracts[wordXor_Xor,cat] returns all abstracts in category 'cat' containing the word exclusive disjunction (Xor) 'wordXor', associated with their article id or date.";
(* ::Subsection::Closed:: *)
(*ArXiv Plot*)
ArXivPlot::usage=
"ArXivPlot[All,cat] draws a DateListPlot of all total article submissions in category 'cat';
ArXivPlot[word_String,cat] draws a DateListPlot of the share of popularity of a title word 'word' in category 'cat';
ArXivPlot[wordL_List,cat] draws a DateListPlot of the share of popularity of the title words list 'wordL' in category 'cat';
ArXivPlot[wordC_And,cat] draws a DateListPlot of the share of popularity of the title words combination 'wordC' in category 'cat';
ArXivPlot[All,logos,cat] draws a DateListPlot of all total articles with the title words construct 'logos' in category 'cat'.";
ArXivPlotTitles::usage=
"ArXivPlotTitles[word_String,cat] draws a DateListPlot of the share of popularity of a title word 'word' in category 'cat';
ArXivPlotTitles[wordL_List,cat] draws a DateListPlot of the share of popularity of the title words list 'wordL' in category 'cat';
ArXivPlotTitles[wordC_And,cat] draws a DateListPlot of the share of popularity of the title words combination 'wordC' in category 'cat';
ArXivPlotTitles[All,logos,cat] draws a DateListPlot of all total articles with the title words construct 'logos' in category 'cat'.";
ArXivPlotAbstracts::usage=
"ArXivPlotAbstracts[word_String,cat] draws a DateListPlot of the share of popularity of an abstract word 'word' in category 'cat';
ArXivPlotAbstracts[wordL_List,cat] draws a DateListPlot of the share of popularity of the abstract words list 'wordL' in category 'cat';
ArXivPlotAbstracts[wordC_And,cat] draws a DateListPlot of the share of popularity of the abstract words combination 'wordC' in category 'cat';
ArXivPlotAbstracts[All,logos,cat] draws a DateListPlot of all total articles with the abstract words construct 'logos' in category 'cat'.";
(* ::Subsection:: *)
(*Neural networks*)
(* ::Subsubsection::Closed:: *)
(*Vocabularies*)
ArXivTitlesVocabulary::usage =
"ArXivTitlesVocabulary[cut_Integer] gives the word vocabulary of all (cleaned) titles of the 'cut' most frequent categories;
ArXivTitlesVocabulary[catL_List] gives the word vocabulary of all (cleaned) titles of the list of categories 'catL'.";
ArXivAbstractsVocabulary::usage =
"ArXivAbstractsVocabulary[cut_Integer] gives the word vocabulary of all (cleaned) abstracts of the 'cut' most frequent categories;
ArXivAbstractsVocabulary[catL_List] gives the word vocabulary of all (cleaned) abstracts of the list of categories 'catL'.";
(* ::Subsubsection::Closed:: *)
(*Category Classifier*)
ArXivClassifyCategoryNet::usage =
"ArXivClassifyCategoryNet[cut_Integer,dim_Integer,drop] gives a net classifying the 'cut' most frequent categories, embedding titles and abstracts in dimension 'dim', with dropout ratio 'drop';
ArXivClassifyCategoryNet[catL_List,dim_Integer,drop] gives a net classifying the 'catL' list of categories, embedding titles and abstracts in dimension 'dim', with dropout ratio 'drop';
ArXivClassifyCategoryNet[catL_List,dim_List,drop] gives a net classifying the 'catL' list of categories, embedding titles in dimension dim[[1]], abstracts in dimension dim[[2]], catenate them and later pass them into a linear layer with dimension dim[[3]], with dropout ratio 'drop'.";
ArXivClassifyCategoryTrainTest::usage =
"ArXivClassifyCategoryTrainTest[cut_Integer,nids_Integer] gives a training and test sets for the net ArXivClassifyCategoryNet[cut,dim,drop] classifying the 'cut' most frequent categories, using up to 'nids' random articles in each category;
ArXivClassifyCategoryTrainTest[catL_List,nids_Integer] gives a training and test sets for the net ArXivClassifyCategoryNet[catL,dim,drop] classifying the 'catL' list of categories, using up to 'nids' random articles in each category.";
(* ::Subsubsection::Closed:: *)
(*Author Classifier*)
ArXivClassifyAuthorNet::usage =
"ArXivClassifyAuthorNet[authorL_List,cat,dim_Integer,drop] gives a net classifying the 'authorL' list of authors in the same category 'cat', embedding titles and abstracts in dimension 'dim', with dropout ratio 'drop';
ArXivClassifyAuthorNet[authorL_List,cat,dim_List,drop] gives a net classifying the 'authorL' list of authors in the same category 'cat', embedding titles in dimension dim[[1]], abstracts in dimension dim[[2]], catenate them and later passing them into a linear layer with dimension dim[[3]], with dropout ratio 'drop';
ArXivClassifyAuthorNet[authorL_List,catL_List,dim_List,drop] gives a net classifying the 'authorL' list of authors in categories given by 'catL' list, embedding titles in dimension dim[[1]], abstracts in dimension dim[[2]], catenate them and later passing them into a linear layer with dimension dim[[3]], with dropout ratio 'drop'.";
ArXivClassifyAuthorTrainTest::usage =
"ArXivClassifyAuthorTrainTest[authorL_List,cat,nids_Integer] gives a training and test sets for the net ArXivClassifyCategoryNet[authorL,dim,drop] classifying the 'authorL' list of authors in the same category 'cat', using up to 'nids' random articles each;
ArXivClassifyAuthorTrainTest[authorL_List,catL_List,nids_Integer] gives a training and test sets for the net ArXivClassifyCategoryNet[authorL,dim,drop] classifying the 'authorL' list of authors, in the categories given by the list 'catL', using up to 'nids' random articles each.";
(* ::Subsection::Closed:: *)
(*LLM*)
(*ArXivLLMConceptDefine;ArXivDefineConcept;*)
(*ArXivLLMAuthorReport;ArXivReportAuthor;*)
(*we want to use aso FindTextualAnswer*)
(*use just simgle word and add criterion "MostRecent" or "MostCitations"*)
ArXivExplainConcept::usage =
"ArXivExplainConcept[concept_String,id_String] explains 'concept' given an article id;
ArXivExplainConcept[concept_String,idL_List] explains 'concept' given an articles list 'idL'.";
ArXivExplainAuthor::usage =
"ArXivExplainAuthor[author_String] explains the work of an 'author';
ArXivExplainAuthor[author_String,cat_] explains the work of an 'author' in category 'cat';
ArXivExplainAuthor[authorL_List] explains the work of an author whose possible names are the list 'authorL'.;
ArXivExplainAuthor[authorL_List,catL_List] the two lists 'doubleL' - the first made of author names and the second of corresponding categories.";
(* ::Subsection:: *)
(*End public Header*)
Begin["DanieleGregori`Private`"];
(*Begin["My`Private`"];*)
(* ::Section:: *)
(*1. ArXiv main database*)
(* ::Subsection:: *)
(*Dataset from Kaggle (optional)*)
(* ::Subsubsection::Closed:: *)
(*Dataset Kaggle download*)
(*only when new download from Kaggle is made:*)
(*you need a Kaggle account*)
(*dirDatabase=FileNameJoin[{StringDelete[NotebookDirectory[],"Kernel"~~_~~EndOfString],"Assets"}];*)
(*datasetFull=Block[{rawDbText,rawDb},
rawDbText=Import[FileNameJoin[{dirDatabase,"arxiv-metadata-oai-snapshot.json"}],"Text"]//EchoTiming;
rawDb=StringJoin["{\"id\":",#]&/@StringSplit[rawDbText,"{\"id\":"]//EchoTiming;
ParallelMap[Interpreter["JSON"],rawDb]//EchoTiming];
Export[FileNameJoin[{dirDatabase,"arxiv-database.json"}],datasetFull]//EchoTiming;*)
(* ::Subsubsection::Closed:: *)
(*Kaggle delete duplicate articles*)
(*datasetDuplicateFree=Block[{ds,idFull,idsDuplicate,positionsDuplicates},
ds=datasetFull;
idFull=Map[Lookup[#,"id"]&,ds]//EchoFunction[Length]//EchoFunction[DuplicateFreeQ]//EchoTiming;
idsDuplicate=Cases[Normal@ReverseSort@Counts[idFull],HoldPattern[_String->n_Integer/;n>=2]]//EchoTiming//Echo;
positionsDuplicates=Position[ds,{"id"->#,__}]&/@Keys[idsDuplicate];
Join[
DeleteCases[ds,Apply[Alternatives,{"id"->#,__}&/@Keys[idsDuplicate]]],
Part[ds,Flatten[Last/@positionsDuplicates]
]
]]//QuietEcho//EchoTiming;*)
(* ::Subsubsection::Closed:: *)
(*Kaggle dataset date ordered*)
(*dateObjects=Block[{assMonths},
assMonths=<|"Jan"->1,"Feb"->2,"Mar"->3,"Apr"->4,"May"->5,"Jun"->6,"Jul"->7,"Aug"->8,"Sep"->9,"Oct"->10,"Nov"->11,"Dec"->12|>;
Map[DateObject@Reverse@
ToExpression@MapAt[
assMonths[#]&,
StringSplit[StringDrop[StringDrop[
Lookup[First@Lookup[#,"versions"],"created"]
,5],-12]],
{2}]&,
datasetDuplicateFree]]//EchoTiming;*)
(*datasetDateOrdered=Flatten[
Values@KeySort@
Merge[Rule@@@
Transpose[{dateObjects,datasetDuplicateFree}],
Identity],
1];//EchoTiming*)
(*ArXivDataset[All]=datasetDateOrdered;*)
(*Export[FileNameJoin[{dirDatabase,"arxiv-database.json"}],ArXivDataset[All]]//EchoTiming;*)
(*datasetDateObjects[All]=KeySort@Merge[Rule@@@Transpose[{dateObjects,datasetDuplicateFree}],Identity];
arXivDatasetDated[All]["Day"]=datasetDateObjects[All];
arXivDatasetDated[All]["Month"]=Map[Flatten[#,1]&,Merge[KeyValueMap[DateObject@Drop[First[#1],-1]->#2&,datasetDateObjects[All]],Identity]];
arXivDatasetDated[All]["Year"]=Map[Flatten[#,1]&,Merge[KeyValueMap[DateObject@Drop[First[#1],-2]->#2&,datasetDateObjects[All]],Identity]];*)
(* ::Subsection:: *)
(*Dataset cleaned import*)
(* ::Subsubsection::Closed:: *)
(*Dataset local import*)
dirDatabase=FileNameJoin[{StringDelete[NotebookDirectory[],"Kernel"~~_~~EndOfString],"Assets"}];
datasetLocal=Import[First@Flatten@StringCases[FileNames["*",dirDatabase],__~~"arxiv-database.json"],"JSON"](*//EchoTiming*);
(*with format json it takes just a bit more than 1 minute*)
(* ::Subsubsection::Closed:: *)
(*Dataset WolframCloud import*)
(*it can take me up to 1 hour to upload*)
(*CloudPut[ArXivDataset[All],"arxiv-database",Permissions->"Public"]//EchoTiming;*)
(*it can take me around 15 minutes do download*)
(* ::Input:: *)
(*(*databaseGet=CloudGet["https://www.wolframcloud.com/obj/dangregori/arxiv-database"]//EchoTiming;*)*)
(* ::Subsubsection::Closed:: *)
(*Dataset setting*)
If[
(datasetLocal=!=$Failed&&ValueQ[datasetLocal])(*//EchoFunction["local imp: ",#&]*),
ArXivDataset[All]=datasetLocal,
ArXivDataset[All]=CloudGet["https://www.wolframcloud.com/obj/dangregori/arxiv-database"]//EchoFunction["cloud imp: ", (#=!=$Failed&&ValueQ[#])&](*;
Export[FileNameJoin[{dirDatabase,"arxiv-database.json"}],ArXivDataset[All],"JSON"]*)];
(* ::Subsubsection::Closed:: *)
(*Dataset dates*)
(*the following dateObjects takes long, about 1 minute*)
(*it would be more clever to compute just the needed dateobjects and then distribute them*)
(*dateObjects=Block[{assMonths},
assMonths=<|"Jan"->1,"Feb"->2,"Mar"->3,"Apr"->4,"May"->5,"Jun"->6,"Jul"->7,"Aug"->8,"Sep"->9,"Oct"->10,"Nov"->11,"Dec"->12|>;
Map[DateObject@Reverse@
ToExpression@MapAt[
assMonths[#]&,
StringSplit[StringDrop[StringDrop[
Lookup[First@Lookup[#,"versions"],"created"]
,5],-12]],
{2}]&,
ArXivDataset[All]]](*//EchoTiming*);*)
(*dateObjects takes half the time*)
(*it can be redundant with arXivVersionsFirstDate later*)
dateStrings=Block[{assMonths},
assMonths=<|"Jan"->1,"Feb"->2,"Mar"->3,"Apr"->4,"May"->5,"Jun"->6,"Jul"->7,"Aug"->8,"Sep"->9,"Oct"->10,"Nov"->11,"Dec"->12|>;
Map[Reverse@
ToExpression@MapAt[
assMonths[#]&,
StringSplit[StringDrop[StringDrop[
Lookup[First@Lookup[#,"versions"],"created"]
,5],-12]],
{2}]&,
ArXivDataset[All]]];
dateObjects=Map[DateObject,dateStrings];
(*(possibly redundant)*)
datasetDateObjects[All]=KeySort@Merge[Rule@@@Transpose[{dateObjects,ArXivDataset[All]}],Identity];
arXivDatasetDated[All]["Day"]=datasetDateObjects[All];
arXivDatasetDated[All]["Month"]=Map[Flatten[#,1]&,Merge[KeyValueMap[DateObject@Drop[First[#1],-1]->#2&,datasetDateObjects[All]],Identity]];
arXivDatasetDated[All]["Year"]=Map[Flatten[#,1]&,Merge[KeyValueMap[DateObject@Drop[First[#1],-2]->#2&,datasetDateObjects[All]],Identity]];
(* ::Section:: *)
(*2. Scraping extra data*)
(* ::Subsection:: *)
(*T EX source files *)
(* ::Subsubsection::Closed:: *)
(*T EX import*)
linksTeXFunc[id_]:="https://arxiv.org/e-print/"<>id
importTeX[id_]:=Import[linksTeXFunc[id],"Text"]
importTeXDoc[id_]:=StringCases[importTeX[id],"\\begin{document}"~~__~~"\\end{document}"][[1]]
(* ::Subsubsection::Closed:: *)
(*T EX partition*)
sectionsTeX[id_]:=(*to improve, it does not always work*)StringSplit[importTeX[id],"\\section"]
ArXivTeXDocument[id_]:=importTeXDoc[id]
ArXivTeXSections[id_]:=(*to improve, it does not always work*)StringSplit[importTeXDoc[id],"\\section"]
sectionsTeXDoc[id_]:=ArXivExtractSections[id]
sectionsNone[id_]:=Block[{tex,texDoc},
texDoc=Enclose@ConfirmQuiet[importTeXDoc[id],Part::partw];
tex=If[!FailureQ[texDoc],texDoc,importTeX[id]];
StringSplit[tex,{"\\end{abstract}","\\begin{thebibliography}"}]]
(* ::Input:: *)
(**)
(*for debugging:*)
(*splitTeX20[id_]:=StringPartition[#,Floor[StringLength[#]/20]]&@importTeX[id]
splitTeX50[id_]:=StringPartition[#,Floor[StringLength[#]/50]]&@importTeX[id]
splitTeX[id_,length_]:=StringPartition[#,length]&@importTeX[id]*)
(* ::Subsection::Closed:: *)
(*Introduction extraction*)
(*about 10% success, can improve*)
(* ::Input::Initialization:: *)
ArXivTeXIntroduction[id_]:=(*to improve, it does not always work*)
Block[{
tex,texDoc,
sections,sectionsAlternative,sectionNone,
casesIntro,casesIntroAlter(*obsolete*),
ifSplitF,
tryCases,trySecond},
texDoc=Enclose@ConfirmQuiet[importTeXDoc[id],Part::partw];
tex=If[!FailureQ[texDoc],texDoc,importTeX[id]];
(*
texUncomm=importTeXDocUncomm[id];*)
(*
EchoFunction["string length tex doc: ",StringLength[texDoc]];*)
sections=StringSplit[tex,"\\section"];
(*having a tex structured in section is not always the case*)
(*other separators: *)
sectionsAlternative=StringSplit[tex,{(*"\\emph",*)"\\sxn",(*"\\textbf",*)"\\newsec"}];
(*no separators, only bibliography: *)
sectionNone=StringSplit[tex,{"\\end{abstract}","\\begin{thebibliography}"}];
casesIntro=
{"{Introduction}"~~__,"{Introduction.}"~~__,"{\\bf Introduction}"~~__,"{\\bf Introduction.}"~~__,"{\\label{"~~__~~"}"<>"Introduction}"~~__,"{\\label{"~~__~~"}"~~Whitespace..~~"Introduction}"~~__,
"{Introduction"~~__~~"\\label{"~~__~~"}}"~~__,
"{Summary}"~~__};
casesIntroAlter=casesIntro;
tryCases=
Flatten@
DeleteCases[
If[Echo[Length[sections],"length sections"]>1,
StringCases[sections,casesIntro],
If[Echo[Length[sectionsAlternative],"length sections alternative"]>1,
StringCases[sectionsAlternative,casesIntroAlter],{sectionNone[[2]]}]
]
,{}];
trySecond=
If[Length[sections]>1,
sections[[2]],
If[Length[sectionsAlternative]>1,
sectionsAlternative[[2]],tex]
];
If[Echo[Length[tryCases],"length cases"]>=1,tryCases[[1]],trySecond]
]//QuietEcho
(* ::Subsection::Closed:: *)
(*Formulae extraction*)
(*can improve*)
arXivTeXBeginEnd[tex_String]:=Module[{listbeg,listend,indexes1},
listbeg=EchoFunction[Length]@StringPosition[tex,"\\begin"];
listend=EchoFunction[Length]@StringPosition[tex,"\\end"];
indexes1=Echo@Union[First/@listbeg,First/@listend];
Join[Table[
First@StringCases[
StringTake[StringDrop[tex,indexes1[[i]]],UpTo[Min[indexes1[[i]]+14,indexes1[[i+1]]]]],
Shortest["begin{"~~__~~"}"]|Shortest["end{"~~__~~"}"]],{i,Range[Length[indexes1]-1]}],{"end{document}"}]]
arXivTeXPartVisualize[texlist_List,keyword_String]:=
Association@DeleteCases[
MapIndexed[First[#2]->TabView@StringCases[#,Shortest["\\begin{"<>keyword<>"}"~~__~~"\\end{"<>keyword<>"}"]]&,texlist],
HoldPattern[_Integer->TabView[{}]]]
ArXivTeXFormulae[id_String,eqword_String]:=
StringCases[ArXivTeXDocument[id],Shortest["\\begin{"<>eqword<>"}"~~__~~"\\end{"<>eqword<>"}"]]
ArXivTeXFormulae[id_String]:=
Association@DeleteCases[Join[
{"$"->StringCases[ArXivTeXDocument[id],Shortest["$"~~__~~"$"]]},
Table[
word->StringCases[ArXivTeXDocument[id],Shortest["\\begin{"<>word<>"}"~~__~~"\\end{"<>word<>"}"]],
{word,{"equation","align","aligned","gather","equation*","align*","aligned*","gather*"}}](*,
{"\\be"->StringCases[ArXivTeXDocument[id],Shortest["\\be"~~__~~"\\ee"]],
"\\bea"->StringCases[ArXivTeXDocument[id],Shortest["\\bea"~~__~~"\\eea"]],
"\\ba"->StringCases[ArXivTeXDocument[id],Shortest["\\ba"~~__~~"\\ea"]]}*)],
HoldPattern[_String->{}]]
(* ::Subsection::Closed:: *)
(*Citations*)
apiCitationsFull[articles_List,field_:"citationCount"]:=Block[{response,posnull,responseclean},(*AssociationThread[articles,*)
response=URLExecute[
HTTPRequest[
"https://api.semanticscholar.org/graph/v1/paper/batch",
<|
"Method"->"POST",
"Headers"->{"Content-Type"->"application/json"},
"Query"->{"fields"->field(*"referenceCount,citationCount,title"*)},
"Body"->ExportString[<|"ids"->Map[StringJoin["ARXIV:",#]&,articles]|>,"JSON"]
|>],
"RawJSON"
];
responseclean=DeleteCases[Sow@response,Null];
posnull=Complement[Table[{i},{i,Length[articles]}],Position[response,<|"paperId"->_String,"citationCount"->_Integer|>]];
If[field=="citationCount",AssociationThread[Delete[articles,posnull],responseclean],response]](*]*)
apiCitationsIDs[articles_List]:=Block[{response},
response=URLExecute[
HTTPRequest[
"https://api.semanticscholar.org/graph/v1/paper/batch",
<|
"Method"->"POST",
"Headers"->{"Content-Type"->"application/json"},
"Query"->{"fields"->"externalIds"},
"Body"->ExportString[<|"ids"->articles|>,"JSON"]
|>],
"RawJSON"
];
Map[Lookup[Lookup[#,"externalIds"],"ArXiv"]&,response]]
ArXivCitationsTotal[articles_List,field_:"citationCount"]:=
KeyValueMap[{#1,Lookup[#2,field]}&,
Association@(*EchoFunction["missing data for id: ",Keys@Complement[Normal@apiCitationsFullGlob[articles],#]&]@*)
DeleteCases[Normal@apiCitationsFull[articles,field],
HoldPattern[_String->_Symbol]]]
ArXivCitationsTotal[id_String,field_:"citationCount"]:=
ArXivCitationsTotal[{id},field]
ArXivCitations[id_String]:=
DeleteMissing@apiCitationsIDs[Flatten@Map[Lookup[#,"paperId"]&,Lookup[apiCitationsFull[{id},"citations"],"citations"]]]
ArXivCitations[idL_List]:=Association@Map[#->ArXivCitations[#]&,idL]
(*ArXivCitations[id_String,n_Integer]:=*)
ArXivCitationsAuthor[author_String,cat___]:=ArXivCitationsAuthor[author,cat]=Block[{part,list1,listc},
part=Partition[Flatten@Values@ArXivArticlesAuthor[author,cat],UpTo[8]];
list1=Quiet@
Flatten[Sow@MapIndexed[Monitor[Table[(Pause[3];(i->ArXivCitations[i])),{i,#}],ProgressIndicator[First[#2]/(Length[part])]]&,part],1];
listc=ReplaceAll[List@@@
DeleteCases[list1,HoldPattern[_String->_DeleteMissing]],
{s_String,l_List?(MemberQ[#,_Lookup]&)}:>{s,DeleteCases[l,_Lookup]}];
Flatten[Map[Thread[Table[#[[1]],Length[#[[2]]]]->#[[2]]]&,listc]]]
ArXivCitationsAuthor[authorL_List,cat___]:=Flatten@Map[ArXivCitationsAuthor[#,cat]&,authorL]
ArXivCitationsAuthor[authorL_List,catL_List]:=Flatten@MapThread[ArXivCitationsAuthor[#1,#2]&,{authorL,catL}]
ArXivGraphAuthor[author_String,cat___,options:OptionsPattern[Graph]]:=
Graph[EchoFunction["total citations",Length]@ArXivCitationsAuthor[author,cat],options(*VertexLabels->Placed[Automatic,Tooltip]*)]
ArXivGraphAuthor[authorL_List,cat___,options:OptionsPattern[Graph]]:=
Graph[EchoFunction["total citations",Length]@Flatten@Map[ArXivCitationsAuthor[#,cat]&,authorL],options]
ArXivGraphAuthor[authorL_List,catL_List,options:OptionsPattern[Graph]]:=
Graph[EchoFunction["total citations",Length]@Flatten@MapThread[ArXivCitationsAuthor[#1,#2]&,{authorL,catL}],options]
ArXivGraph[id_String,options:OptionsPattern[Graph]]:=
Graph[Thread[id->EchoFunction["total citations",Length]@ArXivCitations[id]],options(*VertexLabels->Placed[Automatic,Tooltip]*)]
ArXivGraph[idL_List,options:OptionsPattern[Graph]]:=
Graph[EchoFunction["total citations",Length]@Nest[Cases[DeleteCases[Flatten@Map[Pause[3];Thread[#->Quiet@ArXivCitations[#]]&,#],_?(!FreeQ[#,Failure]&),\[Infinity]],HoldPattern[_String->_String]]&,idL,1],options]
(*ArXivGraph[id_String,options:OptionsPattern[Graph]]:=
Graph[]*)
(*EchoFunction[Length]@Nest[Cases[DeleteCases[Flatten@Map[Thread[#->Quiet@ArXivCitations[#]]&,#],_?(!FreeQ[#,Failure]&),\[Infinity]],HoldPattern[_String->_String]]&,ArXivCitations["1908.08030"],1]*)
(*Graph@%*)
(* ::Subsection::Closed:: *)
(*API new articles (for next release)*)
(*to do*)
(*ArXivNewArticles[]*)
(* ::Section:: *)
(*3. Main data functionality*)
(* ::Subsection:: *)
(*Dataset lookup utilities*)
(* ::Subsubsection::Closed:: *)
(*Dataset lookup (I)*)
datasetKeys=Flatten@Union[Keys/@ArXivDataset[All]];
arXivDatasetKeys=datasetKeys;
(*Clear[ArXivDatasetLookup]*)
ArXivDatasetLookup[key_String]/;MemberQ[datasetKeys,key]:=ArXivDatasetLookup[key]=Cases[ArXivDataset[All],(key->term_):>term,{2}]
ArXivDatasetLookup[key_String,subds_List]/;MemberQ[datasetKeys,key]:=ArXivDatasetLookup[key,subds]=Cases[subds,(key->term_):>term,{2}]
(* ::Subsubsection::Closed:: *)
(*IDs*)
(*maybe ArXivDatasetItem better set as function*)
arXivIDsAssoc[All]:=arXivIDsAssoc[All]=arXivIDsAssoc[]=ArXivDatasetLookup["id"];
arXivDatasetItem=AssociationThread[arXivIDsAssoc[All],ArXivDataset[All]];