-
Notifications
You must be signed in to change notification settings - Fork 0
/
cwb-cads-functionality.html
1731 lines (1700 loc) · 213 KB
/
cwb-cads-functionality.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.57">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Philipp Heinrich">
<meta name="dcterms.date" content="2024-07-24">
<title>cwb-cads functionality</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="cwb-cads-functionality_files/libs/clipboard/clipboard.min.js"></script>
<script src="cwb-cads-functionality_files/libs/quarto-html/quarto.js"></script>
<script src="cwb-cads-functionality_files/libs/quarto-html/popper.min.js"></script>
<script src="cwb-cads-functionality_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="cwb-cads-functionality_files/libs/quarto-html/anchor.min.js"></script>
<link href="cwb-cads-functionality_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="cwb-cads-functionality_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="cwb-cads-functionality_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="cwb-cads-functionality_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="cwb-cads-functionality_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<link href="cwb-cads-functionality_files/libs/pagedtable-1.1/css/pagedtable.css" rel="stylesheet">
<script src="cwb-cads-functionality_files/libs/pagedtable-1.1/js/pagedtable.js"></script>
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
<script type="text/javascript">
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
window.Quarto = {
typesetMath
};
</script>
</head>
<body>
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#setup" id="toc-setup" class="nav-link active" data-scroll-target="#setup"><span class="header-section-number">1</span> Setup</a></li>
<li><a href="#corpora" id="toc-corpora" class="nav-link" data-scroll-target="#corpora"><span class="header-section-number">2</span> Corpora</a>
<ul class="collapse">
<li><a href="#meta-data" id="toc-meta-data" class="nav-link" data-scroll-target="#meta-data"><span class="header-section-number">2.1</span> Meta Data</a></li>
<li><a href="#subcorpora" id="toc-subcorpora" class="nav-link" data-scroll-target="#subcorpora"><span class="header-section-number">2.2</span> Subcorpora</a></li>
</ul></li>
<li><a href="#keyword-analysis" id="toc-keyword-analysis" class="nav-link" data-scroll-target="#keyword-analysis"><span class="header-section-number">3</span> Keyword Analysis</a>
<ul class="collapse">
<li><a href="#example-sz-2018-2022-vs.-faz-2020-2022" id="toc-example-sz-2018-2022-vs.-faz-2020-2022" class="nav-link" data-scroll-target="#example-sz-2018-2022-vs.-faz-2020-2022"><span class="header-section-number">3.1</span> Example: SZ-2018-2022 vs. FAZ-2020-2022</a>
<ul class="collapse">
<li><a href="#creation" id="toc-creation" class="nav-link" data-scroll-target="#creation"><span class="header-section-number">3.1.1</span> Creation</a></li>
<li><a href="#keyword-table" id="toc-keyword-table" class="nav-link" data-scroll-target="#keyword-table"><span class="header-section-number">3.1.2</span> Keyword Table</a></li>
</ul></li>
<li><a href="#example-sz-2020-vs.-sz-2019" id="toc-example-sz-2020-vs.-sz-2019" class="nav-link" data-scroll-target="#example-sz-2020-vs.-sz-2019"><span class="header-section-number">3.2</span> Example: SZ-2020 vs. SZ-2019</a>
<ul class="collapse">
<li><a href="#creation-1" id="toc-creation-1" class="nav-link" data-scroll-target="#creation-1"><span class="header-section-number">3.2.1</span> Creation</a></li>
<li><a href="#keyword-table-1" id="toc-keyword-table-1" class="nav-link" data-scroll-target="#keyword-table-1"><span class="header-section-number">3.2.2</span> Keyword Table</a></li>
</ul></li>
<li><a href="#example-sz-2020-vs.-remainder-of-sz-2018-2022" id="toc-example-sz-2020-vs.-remainder-of-sz-2018-2022" class="nav-link" data-scroll-target="#example-sz-2020-vs.-remainder-of-sz-2018-2022"><span class="header-section-number">3.3</span> Example: SZ-2020 vs. remainder of SZ-2018-2022</a>
<ul class="collapse">
<li><a href="#creation-2" id="toc-creation-2" class="nav-link" data-scroll-target="#creation-2"><span class="header-section-number">3.3.1</span> Creation</a></li>
<li><a href="#keyword-table-2" id="toc-keyword-table-2" class="nav-link" data-scroll-target="#keyword-table-2"><span class="header-section-number">3.3.2</span> Keyword Table</a></li>
<li><a href="#concordance-lines" id="toc-concordance-lines" class="nav-link" data-scroll-target="#concordance-lines"><span class="header-section-number">3.3.3</span> Concordance Lines</a></li>
<li><a href="#visualisation-semantic-map" id="toc-visualisation-semantic-map" class="nav-link" data-scroll-target="#visualisation-semantic-map"><span class="header-section-number">3.3.4</span> Visualisation (Semantic Map)</a></li>
</ul></li>
</ul></li>
<li><a href="#query" id="toc-query" class="nav-link" data-scroll-target="#query"><span class="header-section-number">4</span> Query</a>
<ul class="collapse">
<li><a href="#creation-3" id="toc-creation-3" class="nav-link" data-scroll-target="#creation-3"><span class="header-section-number">4.1</span> Creation</a></li>
<li><a href="#concordancing" id="toc-concordancing" class="nav-link" data-scroll-target="#concordancing"><span class="header-section-number">4.2</span> Concordancing</a>
<ul class="collapse">
<li><a href="#context-settings" id="toc-context-settings" class="nav-link" data-scroll-target="#context-settings"><span class="header-section-number">4.2.1</span> Context Settings</a></li>
<li><a href="#filtering" id="toc-filtering" class="nav-link" data-scroll-target="#filtering"><span class="header-section-number">4.2.2</span> Filtering</a></li>
<li><a href="#sorting" id="toc-sorting" class="nav-link" data-scroll-target="#sorting"><span class="header-section-number">4.2.3</span> Sorting</a></li>
</ul></li>
<li><a href="#breakdown" id="toc-breakdown" class="nav-link" data-scroll-target="#breakdown"><span class="header-section-number">4.3</span> Breakdown</a></li>
<li><a href="#meta-distribution" id="toc-meta-distribution" class="nav-link" data-scroll-target="#meta-distribution"><span class="header-section-number">4.4</span> Meta Distribution</a></li>
<li><a href="#collocation" id="toc-collocation" class="nav-link" data-scroll-target="#collocation"><span class="header-section-number">4.5</span> Collocation</a>
<ul class="collapse">
<li><a href="#creation-4" id="toc-creation-4" class="nav-link" data-scroll-target="#creation-4"><span class="header-section-number">4.5.1</span> Creation</a></li>
<li><a href="#collocation-table" id="toc-collocation-table" class="nav-link" data-scroll-target="#collocation-table"><span class="header-section-number">4.5.2</span> Collocation Table</a></li>
<li><a href="#semantic-map" id="toc-semantic-map" class="nav-link" data-scroll-target="#semantic-map"><span class="header-section-number">4.5.3</span> Semantic Map</a></li>
<li><a href="#concordancing-1" id="toc-concordancing-1" class="nav-link" data-scroll-target="#concordancing-1"><span class="header-section-number">4.5.4</span> Concordancing</a></li>
</ul></li>
</ul></li>
<li><a href="#semantic-maps" id="toc-semantic-maps" class="nav-link" data-scroll-target="#semantic-maps"><span class="header-section-number">5</span> Semantic Maps</a>
<ul class="collapse">
<li><a href="#creation-5" id="toc-creation-5" class="nav-link" data-scroll-target="#creation-5"><span class="header-section-number">5.1</span> Creation</a></li>
<li><a href="#interacting-with-coordinates" id="toc-interacting-with-coordinates" class="nav-link" data-scroll-target="#interacting-with-coordinates"><span class="header-section-number">5.2</span> Interacting with coordinates</a></li>
</ul></li>
</ul>
</nav>
</div>
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">cwb-cads functionality</h1>
</div>
<div class="quarto-title-meta">
<div>
<div class="quarto-title-meta-heading">Author</div>
<div class="quarto-title-meta-contents">
<p>Philipp Heinrich </p>
</div>
</div>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">July 24, 2024</p>
</div>
</div>
</div>
</header>
<section id="setup" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Setup</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">rm</span>(<span class="at">list =</span> <span class="fu">ls</span>())</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(httr2)</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(jsonlite)</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggrepel)</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a>url_api <span class="ot"><-</span> <span class="st">"http://127.0.0.1:5000"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>get API access token via <code>/user/login</code></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>access.token <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/user/login"</span>) <span class="sc">|></span> </span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_method</span>(<span class="st">"POST"</span>) <span class="sc">|></span> </span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_form</span>(<span class="at">password =</span> <span class="st">'mmda-admin'</span>, <span class="at">username =</span> <span class="st">'admin'</span>) <span class="sc">|></span> </span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"access_token"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="corpora" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Corpora</h1>
<ul>
<li>corpus access via <code>/corpus/</code></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>corpora <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/"</span>) <span class="sc">|></span> </span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>()</span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a>corpora</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["cwb_id"],"name":[1],"type":["chr"],"align":["left"]},{"label":["description"],"name":[2],"type":["chr"],"align":["left"]},{"label":["id"],"name":[3],"type":["int"],"align":["right"]},{"label":["language"],"name":[4],"type":["chr"],"align":["left"]},{"label":["name"],"name":[5],"type":["chr"],"align":["left"]},{"label":["p_atts"],"name":[6],"type":["list"],"align":["right"]},{"label":["register"],"name":[7],"type":["chr"],"align":["left"]},{"label":["s_annotations"],"name":[8],"type":["list"],"align":["right"]},{"label":["s_atts"],"name":[9],"type":["list"],"align":["right"]}],"data":[{"1":"SCHWURPUS_V2","2":"Telegram Schwurbler","3":"1","4":"de","5":"Schwurpus (v2)","6":"<chr [3]>","7":"cmc","8":"<chr [37]>","9":"<chr [16]>"},{"1":"GERMAPARL-LP19","2":"Deutscher Bundestag (LP19: 2017 - 2021)","3":"2","4":"de","5":"GermaParl (19. Legislaturperiode)","6":"<chr [4]>","7":"standard","8":"<chr [17]>","9":"<chr [2]>"},{"1":"GERMAPARL-1949-2021","2":"Deutscher Bundestag (1949 - 2021)","3":"3","4":"de","5":"GermaParl (1949 - 2021)","6":"<chr [3]>","7":"standard","8":"<chr [17]>","9":"<chr [2]>"},{"1":"SZ-2018-2022","2":"NA","3":"4","4":"de","5":"Süddeutsche Zeitung (2018 - 2022)","6":"<chr [3]>","7":"standard","8":"<chr [14]>","9":"<chr [5]>"},{"1":"SZ-2009-2014","2":"NA","3":"5","4":"de","5":"Süddeutsche Zeitung (2009 - 2014)","6":"<chr [3]>","7":"standard","8":"<chr [14]>","9":"<chr [5]>"},{"1":"FAZ-2011-2014","2":"NA","3":"6","4":"de","5":"Frankfurter Allgemeine Zeitung (2011 - 2014)","6":"<chr [3]>","7":"standard","8":"<chr [9]>","9":"<chr [3]>"},{"1":"FAZ-2020-2022","2":"NA","3":"7","4":"de","5":"Frankfurter Allgemeine Zeitung (2020 - 2022)","6":"<chr [3]>","7":"standard","8":"<chr [12]>","9":"<chr [5]>"},{"1":"TAGESSCHAU-2010-2022","2":"NA","3":"8","4":"de","5":"Tagesschau (2010 - 2022)","6":"<chr [3]>","7":"standard","8":"<chr [6]>","9":"<chr [4]>"},{"1":"INFODEMIC-TELEGRAM-V2","2":"NA","3":"9","4":"de","5":"Infodemic: Telegram (v2)","6":"<chr [3]>","7":"cmc","8":"<chr [30]>","9":"<chr [16]>"},{"1":"INFODEMIC-TWITTER-USERS-V5","2":"NA","3":"10","4":"de","5":"Infodemic: Twitter Users (v5)","6":"<chr [3]>","7":"cmc","8":"<chr [4]>","9":"<chr [5]>"},{"1":"INFODEMIC-TWITTER-CORONA-DE-V3","2":"NA","3":"11","4":"de","5":"Infodemic: Twitter (v3)","6":"<chr [3]>","7":"cmc","8":"<chr [26]>","9":"<chr [5]>"},{"1":"TWEETS-DE-2019-2022","2":"NA","3":"12","4":"de","5":"German Tweets (2019 - 2022)","6":"<chr [3]>","7":"cmc","8":"<chr [26]>","9":"<chr [5]>"},{"1":"DAPPI2019","2":"NA","3":"13","4":"jap","5":"Tweets by Dappi (2019)","6":"<chr [8]>","7":"cmc","8":"<chr [18]>","9":"<chr [3]>"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>we use <code>"SZ-2018-2022"</code> as an example here</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>corpus.id <span class="ot"><-</span> corpora <span class="sc">|></span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(cwb_id <span class="sc">==</span> <span class="st">"SZ-2018-2022"</span>) <span class="sc">|></span> </span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(id)</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>corpus <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}"</span>) <span class="sc">|></span> </span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="meta-data" class="level2" data-number="2.1">
<h2 data-number="2.1" class="anchored" data-anchor-id="meta-data"><span class="header-section-number">2.1</span> Meta Data</h2>
<ul>
<li>indexed structural (and positional) attributes can be accessed directly at <code>/corpus/<id>/</code></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>corpus <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"p_atts"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "lemma" "word" "pos" </code></pre>
</div>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>corpus <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"s_atts"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "s" "p" "text" "corpus" "issue" </code></pre>
</div>
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>corpus <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"s_annotations"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] "corpus_name" "issue_day" "text_date"
[4] "text_datum" "text_id" "text_month"
[7] "text_nr_sentences" "text_ressort" "text_rubrik"
[10] "text_seite_end" "text_seite_start" "text_seitentitel"
[13] "text_year" "p_type" </code></pre>
</div>
</div>
<ul>
<li><code>s_annotations</code> belong to <code>s_atts</code> (as long as the corpus was correctly indexed)</li>
<li>in this context, we refer to the <code>s_att</code> as <code>level</code> with corresponding <code>key</code>s (such that meta data is stored in <code>level_key</code>)</li>
<li>they are not stored in the database by default</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/meta/"</span>) <span class="sc">|></span> </span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["annotations"],"name":[1],"type":["list"],"align":["right"]},{"label":["level"],"name":[2],"type":["chr"],"align":["left"]}],"data":[{"1":"<df[,2] [1 × 2]>","2":"text","_rn_":"1"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>we can store meta data from annotated s-attributes (<code>level_key</code>) using a <code>PUT</code> request</li>
<li>we specify the <code>value_type</code> here (use <code>"unicode"</code> for categorical data)</li>
<li>this runs idempotently</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/meta/"</span>) <span class="sc">|></span> </span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_method</span>(<span class="st">'PUT'</span>) <span class="sc">|></span> </span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">level =</span> <span class="st">'text'</span>, <span class="at">key =</span> <span class="st">'year'</span>, <span class="at">value_type =</span> <span class="st">'unicode'</span>)) <span class="sc">|></span> </span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>$key
[1] "year"
$value_type
[1] "unicode"</code></pre>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/meta/"</span>) <span class="sc">|></span> </span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> <span class="fu">tibble</span>() <span class="sc">|></span> </span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"annotations"</span>) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[[1]]
key value_type
1 year unicode</code></pre>
</div>
</div>
<ul>
<li>and corresponding frequency counts (only reasonable for categorical data)</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/meta/frequencies"</span>) <span class="sc">|></span> </span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">level =</span> <span class="st">'text'</span>, <span class="at">key =</span> <span class="st">'year'</span>) <span class="sc">|></span> </span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["nr_spans"],"name":[1],"type":["int"],"align":["right"]},{"label":["nr_tokens"],"name":[2],"type":["int"],"align":["right"]},{"label":["value"],"name":[3],"type":["chr"],"align":["left"]}],"data":[{"1":"47448","2":"27084916","3":"y2018","_rn_":"1"},{"1":"45970","2":"26915759","3":"y2019","_rn_":"2"},{"1":"39495","2":"25577102","3":"y2021","_rn_":"3"},{"1":"42395","2":"25043393","3":"y2020","_rn_":"4"},{"1":"33379","2":"23320680","3":"y2022","_rn_":"5"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>if you try to do this without storing the meta data first, you’ll get a <code>404</code></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/meta/frequencies"</span>) <span class="sc">|></span> </span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">level =</span> <span class="st">'text'</span>, <span class="at">key =</span> <span class="st">'month'</span>) <span class="sc">|></span> </span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-error">
<pre><code>Error in `req_perform()`:
! HTTP 404 Not Found.</code></pre>
</div>
</div>
</section>
<section id="subcorpora" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="subcorpora"><span class="header-section-number">2.2</span> Subcorpora</h2>
<ul>
<li>we create subcorpora for each year in <code>"SZ-2018-2022"</code></li>
<li>we need <code>level</code>, <code>key</code>, the corresponding <code>values_unicode</code>, and the <code>name</code> of the subcorpus</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>subcorpora <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/subcorpus/"</span>) <span class="sc">|></span> </span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (y <span class="cf">in</span> <span class="dv">2018</span><span class="sc">:</span><span class="dv">2022</span>){</span>
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a> <span class="co"># we only create the subcorpus if it does not already exist</span></span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a> .subcorpus.exists <span class="ot"><-</span> F</span>
<span id="cb19-10"><a href="#cb19-10" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">length</span>(subcorpora) <span class="sc">></span> <span class="dv">0</span>){</span>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">length</span>(subcorpora <span class="sc">|></span> <span class="fu">filter</span>(name <span class="sc">==</span> <span class="fu">as.character</span>(y), corpus.id <span class="sc">==</span> corpus.id)) <span class="sc">></span> <span class="dv">0</span>){</span>
<span id="cb19-12"><a href="#cb19-12" aria-hidden="true" tabindex="-1"></a> .subcorpus.exists <span class="ot"><-</span> T</span>
<span id="cb19-13"><a href="#cb19-13" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb19-14"><a href="#cb19-14" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb19-15"><a href="#cb19-15" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="sc">!</span>.subcorpus.exists){</span>
<span id="cb19-16"><a href="#cb19-16" aria-hidden="true" tabindex="-1"></a> subcorpus <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/subcorpus/"</span>) <span class="sc">|></span> </span>
<span id="cb19-17"><a href="#cb19-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb19-18"><a href="#cb19-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_method</span>(<span class="st">'PUT'</span>) <span class="sc">|></span> </span>
<span id="cb19-19"><a href="#cb19-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="at">data =</span> <span class="fu">list</span>(<span class="at">level =</span> <span class="st">'text'</span>, <span class="at">key =</span> <span class="st">'year'</span>, <span class="at">values_unicode =</span> <span class="fu">list</span>(<span class="fu">paste0</span>(<span class="st">"y"</span>, <span class="fu">as.character</span>(y))), <span class="at">name =</span> <span class="fu">as.character</span>(y))) <span class="sc">|></span> </span>
<span id="cb19-20"><a href="#cb19-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb19-21"><a href="#cb19-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb19-22"><a href="#cb19-22" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() </span>
<span id="cb19-23"><a href="#cb19-23" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb19-24"><a href="#cb19-24" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>subcorpora <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/corpus/${corpus.id}/subcorpus/"</span>) <span class="sc">|></span> </span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb20-4"><a href="#cb20-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb20-5"><a href="#cb20-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb20-6"><a href="#cb20-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-7"><a href="#cb20-7" aria-hidden="true" tabindex="-1"></a>subcorpora</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["corpus"],"name":[1],"type":["df[,9]"],"align":["right"]},{"label":["description"],"name":[2],"type":["lgl"],"align":["right"]},{"label":["id"],"name":[3],"type":["int"],"align":["right"]},{"label":["name"],"name":[4],"type":["chr"],"align":["left"]},{"label":["nqr_cqp"],"name":[5],"type":["chr"],"align":["left"]}],"data":[{"1":"<df[,9] [5 × 9]>","2":"NA","3":"1","4":"2018","5":"df_6af8c31f4e","_rn_":"1"},{"1":"<df[,9] [5 × 9]>","2":"NA","3":"2","4":"2019","5":"df_535a145a0b","_rn_":"2"},{"1":"<df[,9] [5 × 9]>","2":"NA","3":"3","4":"2020","5":"df_5f708ab4c7","_rn_":"3"},{"1":"<df[,9] [5 × 9]>","2":"NA","3":"4","4":"2021","5":"df_aca6699f18","_rn_":"4"},{"1":"<df[,9] [5 × 9]>","2":"NA","3":"5","4":"2022","5":"df_e81c04ec36","_rn_":"5"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
</section>
</section>
<section id="keyword-analysis" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> Keyword Analysis</h1>
<ul>
<li>keyword analyses are comparisons between two frequency lists (“target” and “reference”)</li>
<li>a frequency list can either be compiled from a whole corpus or a subcorpus</li>
<li>two types of keyword analysis are supported:
<ul>
<li>(sub-)corpus 1 vs. (sub-)corpus 2</li>
<li>subcorpus vs. rest of the corpus</li>
</ul></li>
<li>mode is detected automatically
<ul>
<li>i.e. providing a subcorpus as the target and its original corpus as the reference will automatically switch to subcorpus vs. rest (if not suppressed)</li>
</ul></li>
</ul>
<section id="example-sz-2018-2022-vs.-faz-2020-2022" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="example-sz-2018-2022-vs.-faz-2020-2022"><span class="header-section-number">3.1</span> Example: SZ-2018-2022 vs. FAZ-2020-2022</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>corpus.id <span class="ot"><-</span> corpora <span class="sc">|></span> <span class="fu">filter</span>(cwb_id <span class="sc">==</span> <span class="st">"SZ-2018-2022"</span>) <span class="sc">|></span> <span class="fu">pull</span>(id)</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a>corpus.id.reference <span class="ot"><-</span> corpora <span class="sc">|></span> <span class="fu">filter</span>(cwb_id <span class="sc">==</span> <span class="st">"FAZ-2020-2022"</span>) <span class="sc">|></span> <span class="fu">pull</span>(id)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="creation" class="level3" data-number="3.1.1">
<h3 data-number="3.1.1" class="anchored" data-anchor-id="creation"><span class="header-section-number">3.1.1</span> Creation</h3>
<ul>
<li>different positional attributes can be compared to one another (<code>p</code> and <code>p_reference</code>)
<ul>
<li>default: <code>lemma</code> (fallback if not defined in corpus: <code>word</code>)</li>
</ul></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a>kw.id <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/"</span>)) <span class="sc">|></span> </span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id,</span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a> <span class="at">corpus_id_reference =</span> corpus.id.reference)) <span class="sc">|></span> </span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="keyword-table" class="level3" data-number="3.1.2">
<h3 data-number="3.1.2" class="anchored" data-anchor-id="keyword-table"><span class="header-section-number">3.1.2</span> Keyword Table</h3>
<ul>
<li>the result of a keyword analysis is a frequency comparison table of individual <code>items</code> (i.e. <code>p</code>-types) with corresponding association measures (<code>scores</code>)</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>kw.table.page <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/${kw.id}/items"</span>)) <span class="sc">|></span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a>kw.table.page <span class="sc">|></span> </span>
<span id="cb23-7"><a href="#cb23-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> </span>
<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"scores"</span>) <span class="sc">|></span> </span>
<span id="cb23-9"><a href="#cb23-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_rows</span>(<span class="at">.id =</span> <span class="st">"item"</span>) <span class="sc">|></span></span>
<span id="cb23-10"><a href="#cb23-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> measure, <span class="at">values_from =</span> score) <span class="sc">|></span> </span>
<span id="cb23-11"><a href="#cb23-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">item =</span> kw.table.page <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"item"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["z_score"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["t_score"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["log_likelihood"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["simple_ll"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["min_sensitivity"],"name":[6],"type":["dbl"],"align":["right"]},{"label":["liddell"],"name":[7],"type":["dbl"],"align":["right"]},{"label":["dice"],"name":[8],"type":["dbl"],"align":["right"]},{"label":["log_ratio"],"name":[9],"type":["dbl"],"align":["right"]},{"label":["conservative_log_ratio"],"name":[10],"type":["dbl"],"align":["right"]},{"label":["mutual_information"],"name":[11],"type":["dbl"],"align":["right"]},{"label":["local_mutual_information"],"name":[12],"type":["dbl"],"align":["right"]}],"data":[{"1":"„","2":"579.46566","3":"443.40239","4":"1229382.812","5":"276437.133","6":"0.008945","7":"0.416664","8":"0.017731","9":"29.593564","10":"15.280858","11":"0.232459","12":"266031.369"},{"1":"“","2":"579.39452","3":"443.34795","4":"1229079.899","5":"276369.257","6":"0.008943","7":"0.416663","8":"0.017727","9":"29.593209","10":"15.280503","11":"0.232459","12":"265966.048"},{"1":"–","2":"445.16972","3":"340.64023","4":"724542.092","5":"163151.922","6":"0.005279","7":"0.415767","8":"0.010503","9":"28.832828","10":"14.520113","11":"0.232459","12":"157010.488"},{"1":"…","2":"55.62875","3":"42.56666","4":"11291.081","5":"2547.648","6":"0.000082","7":"0.414501","8":"0.000165","9":"22.831922","10":"8.517837","11":"0.232459","12":"2451.749"},{"1":"►seite","2":"48.46963","3":"37.08857","4":"8571.820","5":"1934.107","6":"0.000063","7":"0.414497","8":"0.000125","9":"22.434423","10":"8.119897","11":"0.232459","12":"1861.302"},{"1":"‘","2":"47.97374","3":"36.70911","4":"8397.318","5":"1894.734","6":"0.000061","7":"0.414496","8":"0.000123","9":"22.404751","10":"8.090186","11":"0.232459","12":"1823.411"},{"1":"81677","2":"44.98471","3":"34.42193","4":"7383.495","5":"1665.984","6":"0.000054","7":"0.414495","8":"0.000108","9":"22.219131","10":"7.904309","11":"0.232459","12":"1603.272"},{"1":"SZ","2":"95.19898","3":"72.91103","4":"32577.010","5":"7466.428","6":"0.000243","7":"0.412743","8":"0.000486","9":"8.618932","10":"7.594933","11":"0.231678","12":"7205.652"},{"1":"Erdoğan","2":"40.25888","3":"30.80576","4":"5913.623","5":"1334.333","6":"0.000043","7":"0.414492","8":"0.000086","9":"21.898875","10":"7.583524","11":"0.232459","12":"1284.105"},{"1":"089","2":"54.01359","3":"41.34733","4":"10561.670","5":"2402.614","6":"0.000078","7":"0.413699","8":"0.000156","9":"9.785369","10":"7.485245","11":"0.232111","12":"2315.077"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>by default, the top <code>page_size=10</code> items according to <code>sort_by="conservative_log_ratio"</code> are given</li>
<li>you can switch between different association measures and paginate through results</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb24"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>kw.table.page <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/${kw.id}/items"</span>)) <span class="sc">|></span></span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">sort_by =</span> <span class="st">"log_likelihood"</span>, <span class="at">page_size =</span> <span class="dv">20</span>, <span class="at">page_number =</span> <span class="dv">2</span>) <span class="sc">|></span> </span>
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb24-4"><a href="#cb24-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb24-5"><a href="#cb24-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb24-6"><a href="#cb24-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb24-7"><a href="#cb24-7" aria-hidden="true" tabindex="-1"></a>kw.table.page <span class="sc">|></span> </span>
<span id="cb24-8"><a href="#cb24-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> </span>
<span id="cb24-9"><a href="#cb24-9" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"scores"</span>) <span class="sc">|></span> </span>
<span id="cb24-10"><a href="#cb24-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_rows</span>(<span class="at">.id =</span> <span class="st">"item"</span>) <span class="sc">|></span></span>
<span id="cb24-11"><a href="#cb24-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> measure, <span class="at">values_from =</span> score) <span class="sc">|></span> </span>
<span id="cb24-12"><a href="#cb24-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">item =</span> kw.table.page <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"item"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["z_score"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["t_score"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["log_likelihood"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["simple_ll"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["min_sensitivity"],"name":[6],"type":["dbl"],"align":["right"]},{"label":["liddell"],"name":[7],"type":["dbl"],"align":["right"]},{"label":["dice"],"name":[8],"type":["dbl"],"align":["right"]},{"label":["log_ratio"],"name":[9],"type":["dbl"],"align":["right"]},{"label":["conservative_log_ratio"],"name":[10],"type":["dbl"],"align":["right"]},{"label":["mutual_information"],"name":[11],"type":["dbl"],"align":["right"]},{"label":["local_mutual_information"],"name":[12],"type":["dbl"],"align":["right"]}],"data":[{"1":"5","2":"84.99500","3":"70.90760","4":"19733.83","5":"6355.205","6":"0.000425","7":"0.255840","8":"0.000850","9":"1.907720","10":"1.816106","11":"0.157401","12":"8562.465"},{"1":"8","2":"81.86566","3":"66.12309","4":"19365.43","5":"5753.559","6":"0.000283","7":"0.312046","8":"0.000565","9":"2.631992","10":"2.492895","11":"0.185497","12":"6711.848"},{"1":"?","2":"85.74195","3":"79.16838","4":"18347.89","5":"6961.075","6":"0.002253","7":"0.101466","8":"0.004491","9":"0.634330","10":"0.605852","11":"0.069283","12":"19971.304"},{"1":"/","2":"82.53612","3":"73.10081","4":"17460.44","5":"6261.973","6":"0.000899","7":"0.161017","8":"0.001795","9":"1.059154","10":"1.009111","11":"0.105444","12":"12125.608"},{"1":"mal","2":"76.55741","3":"67.16296","4":"15139.27","5":"5350.655","6":"0.000664","7":"0.175345","8":"0.001328","9":"1.170684","10":"1.110795","11":"0.113715","12":"9665.987"},{"1":"Tel.","2":"66.30891","3":"51.05587","4":"15059.53","5":"3637.546","6":"0.000123","7":"0.402138","8":"0.000246","9":"5.820306","10":"5.241923","11":"0.227052","12":"3570.399"},{"1":"9","2":"72.19197","3":"58.43407","4":"14991.52","5":"4481.429","6":"0.000224","7":"0.308215","8":"0.000449","9":"2.573067","10":"2.419910","11":"0.183646","12":"5273.565"},{"1":"Bayern","2":"74.56835","3":"63.09584","4":"14906.89","5":"4943.445","6":"0.000386","7":"0.232348","8":"0.000771","9":"1.667839","10":"1.578007","11":"0.145108","12":"7160.625"},{"1":"ja","2":"75.74090","3":"66.77061","4":"14757.40","5":"5255.610","6":"0.000702","7":"0.167982","8":"0.001402","9":"1.112907","10":"1.055498","11":"0.109490","12":"9830.034"},{"1":"3.","2":"68.22106","3":"56.25510","4":"12939.60","5":"4058.680","6":"0.000242","7":"0.275627","8":"0.000483","9":"2.133730","10":"2.004190","11":"0.167513","12":"5175.819"},{"1":"man","2":"72.01761","3":"67.91091","4":"12815.40","5":"4983.615","6":"0.002936","7":"0.073147","8":"0.005847","9":"0.448728","10":"0.424831","11":"0.050998","12":"19159.787"},{"1":"sie","2":"71.73792","3":"68.90399","4":"12655.06","5":"5008.075","6":"0.006187","7":"0.049436","8":"0.012254","9":"0.298413","10":"0.282490","11":"0.035009","12":"27711.087"},{"1":"süddeutsch","2":"63.33340","3":"49.59427","4":"12634.68","5":"3362.376","6":"0.000128","7":"0.369378","8":"0.000257","9":"3.904655","10":"3.599082","11":"0.212402","12":"3491.685"},{"1":"2.","2":"65.08842","3":"54.16836","4":"11612.15","5":"3720.135","6":"0.000243","7":"0.259915","8":"0.000485","9":"1.952570","10":"1.829977","11":"0.159516","12":"4953.296"},{"1":"er","2":"68.62856","3":"65.81414","4":"11578.87","5":"4578.429","6":"0.005246","7":"0.051396","8":"0.010405","9":"0.310836","10":"0.293498","11":"0.036371","12":"24409.842"},{"1":"…","2":"55.62875","3":"42.56666","4":"11291.08","5":"2547.648","6":"0.000082","7":"0.414501","8":"0.000165","9":"22.831922","10":"8.517837","11":"0.232459","12":"2451.749"},{"1":"Firma","2":"63.86015","3":"53.27279","4":"11139.59","5":"3587.441","6":"0.000240","7":"0.255899","8":"0.000480","9":"1.908723","10":"1.786959","11":"0.157449","12":"4832.111"},{"1":"089","2":"54.01359","3":"41.34733","4":"10561.67","5":"2402.614","6":"0.000078","7":"0.413699","8":"0.000156","9":"9.785369","10":"7.485245","11":"0.232111","12":"2315.077"},{"1":";","2":"64.47523","3":"58.55218","4":"10465.98","5":"3890.329","6":"0.000872","7":"0.124542","8":"0.001742","9":"0.793152","10":"0.745624","11":"0.083700","12":"9338.709"},{"1":"1.","2":"63.05065","3":"54.37968","4":"10431.97","5":"3584.426","6":"0.000352","7":"0.201664","8":"0.000704","9":"1.388222","10":"1.301196","11":"0.128506","12":"5792.400"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
</section>
</section>
<section id="example-sz-2020-vs.-sz-2019" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="example-sz-2020-vs.-sz-2019"><span class="header-section-number">3.2</span> Example: SZ-2020 vs. SZ-2019</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb25"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>subcorpus.id <span class="ot"><-</span> subcorpora <span class="sc">|></span> <span class="fu">filter</span>(name <span class="sc">==</span> <span class="st">"2020"</span>) <span class="sc">|></span> <span class="fu">pull</span>(id)</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a>subcorpus.id.reference <span class="ot"><-</span> subcorpora <span class="sc">|></span> <span class="fu">filter</span>(name <span class="sc">==</span> <span class="st">"2019"</span>) <span class="sc">|></span> <span class="fu">pull</span>(id)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="creation-1" class="level3" data-number="3.2.1">
<h3 data-number="3.2.1" class="anchored" data-anchor-id="creation-1"><span class="header-section-number">3.2.1</span> Creation</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>kw.id <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/"</span>)) <span class="sc">|></span> </span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id,</span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a> <span class="at">subcorpus_id =</span> subcorpus.id,</span>
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a> <span class="at">corpus_id_reference =</span> corpus.id.reference,</span>
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true" tabindex="-1"></a> <span class="at">subcorpus_id_reference =</span> subcorpus.id.reference,</span>
<span id="cb26-6"><a href="#cb26-6" aria-hidden="true" tabindex="-1"></a> <span class="at">p =</span> <span class="st">'lemma'</span>,</span>
<span id="cb26-7"><a href="#cb26-7" aria-hidden="true" tabindex="-1"></a> <span class="at">p_reference =</span> <span class="st">'lemma'</span>)) <span class="sc">|></span> </span>
<span id="cb26-8"><a href="#cb26-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb26-9"><a href="#cb26-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb26-10"><a href="#cb26-10" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb26-11"><a href="#cb26-11" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="keyword-table-1" class="level3" data-number="3.2.2">
<h3 data-number="3.2.2" class="anchored" data-anchor-id="keyword-table-1"><span class="header-section-number">3.2.2</span> Keyword Table</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>kw.items <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/${kw.id}/items"</span>)) <span class="sc">|></span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb27-3"><a href="#cb27-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb27-4"><a href="#cb27-4" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb27-5"><a href="#cb27-5" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb27-6"><a href="#cb27-6" aria-hidden="true" tabindex="-1"></a>kw.items <span class="sc">|></span> </span>
<span id="cb27-7"><a href="#cb27-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> </span>
<span id="cb27-8"><a href="#cb27-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"scores"</span>) <span class="sc">|></span> </span>
<span id="cb27-9"><a href="#cb27-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_rows</span>(<span class="at">.id =</span> <span class="st">"item"</span>) <span class="sc">|></span></span>
<span id="cb27-10"><a href="#cb27-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> measure, <span class="at">values_from =</span> score) <span class="sc">|></span> </span>
<span id="cb27-11"><a href="#cb27-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">item =</span> kw.items <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"item"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["z_score"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["t_score"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["log_likelihood"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["simple_ll"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["min_sensitivity"],"name":[6],"type":["dbl"],"align":["right"]},{"label":["liddell"],"name":[7],"type":["dbl"],"align":["right"]},{"label":["dice"],"name":[8],"type":["dbl"],"align":["right"]},{"label":["log_ratio"],"name":[9],"type":["dbl"],"align":["right"]},{"label":["conservative_log_ratio"],"name":[10],"type":["dbl"],"align":["right"]},{"label":["mutual_information"],"name":[11],"type":["dbl"],"align":["right"]},{"label":["local_mutual_information"],"name":[12],"type":["dbl"],"align":["right"]}],"data":[{"1":"Corona-Krise","2":"56.60951","3":"39.30112","4":"8402.694","5":"2438.5888","6":"0.000230","7":"0.518075","8":"0.000460","9":"22.560656","10":"8.319040","11":"0.316969","12":"1824.4729"},{"1":"Coronavirus","2":"50.53513","3":"35.08399","4":"6696.059","5":"1943.3299","6":"0.000183","7":"0.518063","8":"0.000366","9":"22.233141","10":"7.990906","11":"0.316969","12":"1453.9363"},{"1":"Corona-Pandemie","2":"41.57094","3":"28.86060","4":"4531.095","5":"1315.0416","6":"0.000124","7":"0.518049","8":"0.000248","9":"21.669719","10":"7.426029","11":"0.316969","12":"983.8714"},{"1":"Corona","2":"62.85839","3":"43.67915","4":"10241.596","5":"3008.9479","6":"0.000285","7":"0.516270","8":"0.000570","9":"9.203966","10":"7.340117","11":"0.316178","12":"2255.6153"},{"1":"Pandemie","2":"65.19711","3":"45.31895","4":"10983.647","5":"3237.8864","6":"0.000307","7":"0.515629","8":"0.000614","9":"8.764598","10":"7.168275","11":"0.315897","12":"2428.9323"},{"1":"Covid-19","2":"32.20590","3":"22.35893","4":"2719.485","5":"789.2792","6":"0.000074","7":"0.518036","8":"0.000149","9":"20.933218","10":"6.686531","11":"0.316969","12":"590.5130"},{"1":"Lockdown","2":"32.34170","3":"22.48285","4":"2700.477","5":"796.8220","6":"0.000076","7":"0.515402","8":"0.000151","9":"8.668264","10":"5.977867","11":"0.315823","12":"597.8535"},{"1":"Infektionszahl","2":"22.85233","3":"15.86522","4":"1369.213","5":"397.3934","6":"0.000037","7":"0.518027","8":"0.000075","9":"19.943251","10":"5.689160","11":"0.316969","12":"297.3168"},{"1":"Maskenpflicht","2":"22.48391","3":"15.60945","4":"1325.421","5":"384.6836","6":"0.000036","7":"0.518027","8":"0.000073","9":"19.896355","10":"5.641771","11":"0.316969","12":"287.8077"},{"1":"Corona-Zeit","2":"21.61275","3":"15.00464","4":"1224.699","5":"355.4510","6":"0.000034","7":"0.518026","8":"0.000067","9":"19.782334","10":"5.526481","11":"0.316969","12":"265.9369"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
</section>
</section>
<section id="example-sz-2020-vs.-remainder-of-sz-2018-2022" class="level2" data-number="3.3">
<h2 data-number="3.3" class="anchored" data-anchor-id="example-sz-2020-vs.-remainder-of-sz-2018-2022"><span class="header-section-number">3.3</span> Example: SZ-2020 vs. remainder of SZ-2018-2022</h2>
<section id="creation-2" class="level3" data-number="3.3.1">
<h3 data-number="3.3.1" class="anchored" data-anchor-id="creation-2"><span class="header-section-number">3.3.1</span> Creation</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>kw.id <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/"</span>)) <span class="sc">|></span> </span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id,</span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a> <span class="at">subcorpus_id =</span> subcorpus.id,</span>
<span id="cb28-4"><a href="#cb28-4" aria-hidden="true" tabindex="-1"></a> <span class="at">corpus_id_reference =</span> corpus.id,</span>
<span id="cb28-5"><a href="#cb28-5" aria-hidden="true" tabindex="-1"></a> <span class="at">p =</span> <span class="st">'lemma'</span>,</span>
<span id="cb28-6"><a href="#cb28-6" aria-hidden="true" tabindex="-1"></a> <span class="at">p_reference =</span> <span class="st">'lemma'</span>)) <span class="sc">|></span> </span>
<span id="cb28-7"><a href="#cb28-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb28-8"><a href="#cb28-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb28-9"><a href="#cb28-9" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb28-10"><a href="#cb28-10" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="keyword-table-2" class="level3" data-number="3.3.2">
<h3 data-number="3.3.2" class="anchored" data-anchor-id="keyword-table-2"><span class="header-section-number">3.3.2</span> Keyword Table</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb29"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a>kw.items <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/${kw.id}/items"</span>)) <span class="sc">|></span></span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb29-3"><a href="#cb29-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb29-4"><a href="#cb29-4" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb29-5"><a href="#cb29-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>)</span>
<span id="cb29-6"><a href="#cb29-6" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb29-7"><a href="#cb29-7" aria-hidden="true" tabindex="-1"></a>kw.items<span class="sc">$</span>scores <span class="sc">|></span> </span>
<span id="cb29-8"><a href="#cb29-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_rows</span>(<span class="at">.id =</span> <span class="st">"item"</span>) <span class="sc">|></span></span>
<span id="cb29-9"><a href="#cb29-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> measure, <span class="at">values_from =</span> score) <span class="sc">|></span> </span>
<span id="cb29-10"><a href="#cb29-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">item =</span> kw.items<span class="sc">$</span>item)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["z_score"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["t_score"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["log_likelihood"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["simple_ll"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["min_sensitivity"],"name":[6],"type":["dbl"],"align":["right"]},{"label":["liddell"],"name":[7],"type":["dbl"],"align":["right"]},{"label":["dice"],"name":[8],"type":["dbl"],"align":["right"]},{"label":["log_ratio"],"name":[9],"type":["dbl"],"align":["right"]},{"label":["conservative_log_ratio"],"name":[10],"type":["dbl"],"align":["right"]},{"label":["mutual_information"],"name":[11],"type":["dbl"],"align":["right"]},{"label":["local_mutual_information"],"name":[12],"type":["dbl"],"align":["right"]}],"data":[{"1":"Corona-Bonds","2":"19.45400","3":"8.643967","4":"367.3044","5":"190.1959","6":"5.0e-06","7":"0.795713","8":"9.0e-06","9":"8.895271","10":"4.269698","11":"0.704592","12":"81.73262"},{"1":"Coronavirus-Krise","2":"22.26547","3":"10.146700","4":"462.7709","5":"255.6605","6":"7.0e-06","7":"0.746789","8":"1.3e-05","9":"6.074208","10":"3.869406","11":"0.682614","12":"111.94871"},{"1":"Tegnell","2":"16.00656","3":"7.126393","4":"247.3770","5":"129.0236","6":"3.0e-06","7":"0.791760","8":"6.0e-06","9":"8.341076","10":"3.650846","11":"0.702857","12":"55.52567"},{"1":"allesgute","2":"14.42867","3":"6.383612","4":"205.5018","5":"104.1650","6":"3.0e-06","7":"0.804260","8":"5.0e-06","9":"17.981807","10":"3.515506","11":"0.708319","12":"44.62413"},{"1":"Coronakrise","2":"34.05784","3":"16.446319","4":"1055.8953","5":"633.9752","6":"1.8e-05","7":"0.643678","8":"3.7e-05","9":"4.424765","10":"3.510936","11":"0.632297","12":"290.85650"},{"1":"Bahrain-McLaren","2":"15.15852","3":"6.753581","4":"221.4936","5":"115.7977","6":"3.0e-06","7":"0.790371","8":"6.0e-06","9":"8.187045","10":"3.473790","11":"0.702245","12":"49.85942"},{"1":"Corona-Krise","2":"108.21247","3":"55.739126","4":"10689.5960","5":"6816.7834","6":"2.3e-04","7":"0.542052","8":"4.6e-04","9":"3.530979","10":"3.318656","11":"0.576234","12":"3316.80461"},{"1":"Corona-Epidemie","2":"23.29623","3":"11.062283","4":"495.6359","5":"291.7141","6":"8.0e-06","7":"0.672346","8":"1.6e-05","9":"4.756909","10":"3.306570","11":"0.646882","12":"131.96388"},{"1":"Kosanke","2":"14.37555","3":"6.409609","4":"198.8661","5":"104.2253","6":"3.0e-06","7":"0.788875","8":"5.0e-06","9":"8.037300","10":"3.299070","11":"0.701586","12":"44.90151"},{"1":"Ausgangsbeschränkung","2":"36.34930","3":"17.964151","4":"1201.2078","5":"738.8349","6":"2.3e-05","7":"0.605681","8":"4.5e-05","9":"4.051536","10":"3.297301","11":"0.612179","12":"345.88101"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
</section>
<section id="concordance-lines" class="level3" data-number="3.3.3">
<h3 data-number="3.3.3" class="anchored" data-anchor-id="concordance-lines"><span class="header-section-number">3.3.3</span> Concordance Lines</h3>
<ul>
<li>here: concordances of specific items on the keyword list</li>
<li>concordances always belong to a query (in this case: a query for the item)</li>
<li>we create a query using the assisted query endpoint (<code>/query/assisted/</code>), see below for more details</li>
<li>note that we performed the keyword analysis on the <code>p="lemma"</code> layer</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>query <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/assisted"</span>)) <span class="sc">|></span> </span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">p =</span> <span class="st">"lemma"</span>, <span class="at">items =</span> <span class="fu">list</span>(<span class="st">"Corona-Bonds"</span>), <span class="at">corpus_id =</span> corpus.id)) <span class="sc">|></span> </span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb30-6"><a href="#cb30-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb30-7"><a href="#cb30-7" aria-hidden="true" tabindex="-1"></a>query.id <span class="ot"><-</span> query <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>access to concordance lines via <code>/query/<id>/concordance</code></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb31"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb31-5"><a href="#cb31-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>by default, all available structural data (as stored in CWB) are returned</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb32"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"structural"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["corpus_name"],"name":[1],"type":["chr"],"align":["left"]},{"label":["issue_day"],"name":[2],"type":["chr"],"align":["left"]},{"label":["p_type"],"name":[3],"type":["chr"],"align":["left"]},{"label":["text_date"],"name":[4],"type":["chr"],"align":["left"]},{"label":["text_datum"],"name":[5],"type":["chr"],"align":["left"]},{"label":["text_id"],"name":[6],"type":["chr"],"align":["left"]},{"label":["text_month"],"name":[7],"type":["chr"],"align":["left"]},{"label":["text_nr_sentences"],"name":[8],"type":["chr"],"align":["left"]},{"label":["text_ressort"],"name":[9],"type":["chr"],"align":["left"]},{"label":["text_rubrik"],"name":[10],"type":["chr"],"align":["left"]},{"label":["text_seite_end"],"name":[11],"type":["chr"],"align":["left"]},{"label":["text_seite_start"],"name":[12],"type":["chr"],"align":["left"]},{"label":["text_seitentitel"],"name":[13],"type":["chr"],"align":["left"]},{"label":["text_year"],"name":[14],"type":["chr"],"align":["left"]}],"data":[{"1":"SZ-2018-2022","2":"20200325","3":"absatz","4":"20200325","5":"25032020","6":"A107916350","7":"m202003","8":"42","9":"meinungsseite","10":"leitartikel","11":"nan","12":"4","13":"na","14":"y2020","_rn_":"1"},{"1":"SZ-2018-2022","2":"20200328","3":"absatz","4":"20200328","5":"28032020","6":"A107918723","7":"m202003","8":"38","9":"politik","10":"na","11":"nan","12":"8","13":"na","14":"y2020","_rn_":"2"},{"1":"SZ-2018-2022","2":"20200330","3":"absatz","4":"20200330","5":"30032020","6":"A107919865","7":"m202003","8":"29","9":"politik","10":"na","11":"nan","12":"1","13":"na","14":"y2020","_rn_":"3"},{"1":"SZ-2018-2022","2":"20200331","3":"absatz","4":"20200331","5":"31032020","6":"A107923845","7":"m202003","8":"71","9":"wirtschaft","10":"na","11":"nan","12":"17","13":"na","14":"y2020","_rn_":"4"},{"1":"SZ-2018-2022","2":"20200331","3":"absatz","4":"20200331","5":"31032020","6":"A107923845","7":"m202003","8":"71","9":"wirtschaft","10":"na","11":"nan","12":"17","13":"na","14":"y2020","_rn_":"5"},{"1":"SZ-2018-2022","2":"20200331","3":"absatz","4":"20200331","5":"31032020","6":"A107923845","7":"m202003","8":"71","9":"wirtschaft","10":"na","11":"nan","12":"17","13":"na","14":"y2020","_rn_":"6"},{"1":"SZ-2018-2022","2":"20200331","3":"absatz","4":"20200331","5":"31032020","6":"A107923845","7":"m202003","8":"71","9":"wirtschaft","10":"na","11":"nan","12":"17","13":"na","14":"y2020","_rn_":"7"},{"1":"SZ-2018-2022","2":"20200401","3":"titel","4":"20200401","5":"1042020","6":"A107930332","7":"m202004","8":"47","9":"politik","10":"aufmacher","11":"nan","12":"1","13":"na","14":"y2020","_rn_":"8"},{"1":"SZ-2018-2022","2":"20200401","3":"absatz","4":"20200401","5":"1042020","6":"A107930332","7":"m202004","8":"47","9":"politik","10":"aufmacher","11":"nan","12":"1","13":"na","14":"y2020","_rn_":"9"},{"1":"SZ-2018-2022","2":"20200401","3":"absatz","4":"20200401","5":"1042020","6":"A107930332","7":"m202004","8":"47","9":"politik","10":"aufmacher","11":"nan","12":"1","13":"na","14":"y2020","_rn_":"10"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>only two positional attributes (<code>primary="word"</code> and <code>secondary="lemma"</code>) are returned</li>
<li>actual concordance lines (as verticalised text) can be found in <code>tokens</code></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb33"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"tokens"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="dv">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["cpos"],"name":[1],"type":["int"],"align":["right"]},{"label":["is_filter_item"],"name":[2],"type":["lgl"],"align":["right"]},{"label":["offset"],"name":[3],"type":["int"],"align":["right"]},{"label":["out_of_window"],"name":[4],"type":["lgl"],"align":["right"]},{"label":["primary"],"name":[5],"type":["chr"],"align":["left"]},{"label":["secondary"],"name":[6],"type":["chr"],"align":["left"]}],"data":[{"1":"60285281","2":"FALSE","3":"-50","4":"TRUE","5":"unter","6":"unter","_rn_":"1"},{"1":"60285282","2":"FALSE","3":"-49","4":"TRUE","5":"hohen","6":"hoch","_rn_":"2"},{"1":"60285283","2":"FALSE","3":"-48","4":"TRUE","5":"Schulden","6":"Schuld","_rn_":"3"},{"1":"60285284","2":"FALSE","3":"-47","4":"TRUE","5":".","6":".","_rn_":"4"},{"1":"60285285","2":"FALSE","3":"-46","4":"TRUE","5":"Conte","6":"Conte","_rn_":"5"},{"1":"60285286","2":"FALSE","3":"-45","4":"TRUE","5":"drohte","6":"drohen","_rn_":"6"},{"1":"60285287","2":"FALSE","3":"-44","4":"TRUE","5":"zwischenzeitlich","6":"zwischenzeitlich","_rn_":"7"},{"1":"60285288","2":"FALSE","3":"-43","4":"TRUE","5":",","6":",","_rn_":"8"},{"1":"60285289","2":"FALSE","3":"-42","4":"TRUE","5":"die","6":"der","_rn_":"9"},{"1":"60285290","2":"FALSE","3":"-41","4":"TRUE","5":"Abschlusserklärung","6":"Abschlusserklärung","_rn_":"10"},{"1":"60285291","2":"FALSE","3":"-40","4":"TRUE","5":"nicht","6":"nicht","_rn_":"11"},{"1":"60285292","2":"FALSE","3":"-39","4":"TRUE","5":"mitzutragen","6":"mittragen","_rn_":"12"},{"1":"60285293","2":"FALSE","3":"-38","4":"TRUE","5":"–","6":"–","_rn_":"13"},{"1":"60285294","2":"FALSE","3":"-37","4":"TRUE","5":"ein","6":"ein","_rn_":"14"},{"1":"60285295","2":"FALSE","3":"-36","4":"TRUE","5":"Eklat","6":"Eklat","_rn_":"15"},{"1":"60285296","2":"FALSE","3":"-35","4":"TRUE","5":".","6":".","_rn_":"16"},{"1":"60285297","2":"FALSE","3":"-34","4":"TRUE","5":"Der","6":"der","_rn_":"17"},{"1":"60285298","2":"FALSE","3":"-33","4":"TRUE","5":"Italiener","6":"Italiener","_rn_":"18"},{"1":"60285299","2":"FALSE","3":"-32","4":"TRUE","5":"verlangte","6":"verlangen","_rn_":"19"},{"1":"60285300","2":"FALSE","3":"-31","4":"TRUE","5":"„","6":"„","_rn_":"20"},{"1":"60285301","2":"FALSE","3":"-30","4":"TRUE","5":"innovative","6":"innovativ","_rn_":"21"},{"1":"60285302","2":"FALSE","3":"-29","4":"TRUE","5":"Finanzinstrumente","6":"Finanzinstrument","_rn_":"22"},{"1":"60285303","2":"FALSE","3":"-28","4":"TRUE","5":"“","6":"“","_rn_":"23"},{"1":"60285304","2":"FALSE","3":"-27","4":"TRUE","5":".","6":".","_rn_":"24"},{"1":"60285305","2":"FALSE","3":"-26","4":"TRUE","5":"Bereits","6":"bereits","_rn_":"25"},{"1":"60285306","2":"FALSE","3":"-25","4":"TRUE","5":"kurz","6":"kurz","_rn_":"26"},{"1":"60285307","2":"FALSE","3":"-24","4":"TRUE","5":"vor","6":"vor","_rn_":"27"},{"1":"60285308","2":"FALSE","3":"-23","4":"TRUE","5":"dem","6":"der","_rn_":"28"},{"1":"60285309","2":"FALSE","3":"-22","4":"TRUE","5":"Gipfel","6":"Gipfel","_rn_":"29"},{"1":"60285310","2":"FALSE","3":"-21","4":"TRUE","5":"hatten","6":"haben","_rn_":"30"},{"1":"60285311","2":"FALSE","3":"-20","4":"TRUE","5":"Conte","6":"Conte","_rn_":"31"},{"1":"60285312","2":"FALSE","3":"-19","4":"TRUE","5":",","6":",","_rn_":"32"},{"1":"60285313","2":"FALSE","3":"-18","4":"TRUE","5":"Sánchez","6":"Sánchez","_rn_":"33"},{"1":"60285314","2":"FALSE","3":"-17","4":"TRUE","5":",","6":",","_rn_":"34"},{"1":"60285315","2":"FALSE","3":"-16","4":"TRUE","5":"Macron","6":"Macron","_rn_":"35"},{"1":"60285316","2":"FALSE","3":"-15","4":"TRUE","5":"und","6":"und","_rn_":"36"},{"1":"60285317","2":"FALSE","3":"-14","4":"TRUE","5":"sechs","6":"sechs","_rn_":"37"},{"1":"60285318","2":"FALSE","3":"-13","4":"TRUE","5":"weitere","6":"weit","_rn_":"38"},{"1":"60285319","2":"FALSE","3":"-12","4":"TRUE","5":"Staats-","6":"Staat","_rn_":"39"},{"1":"60285320","2":"FALSE","3":"-11","4":"TRUE","5":"und","6":"und","_rn_":"40"},{"1":"60285321","2":"FALSE","3":"-10","4":"FALSE","5":"Regierungschefs","6":"Regierungschef","_rn_":"41"},{"1":"60285322","2":"FALSE","3":"-9","4":"FALSE","5":"solch","6":"solch","_rn_":"42"},{"1":"60285323","2":"FALSE","3":"-8","4":"FALSE","5":"ein","6":"ein","_rn_":"43"},{"1":"60285324","2":"FALSE","3":"-7","4":"FALSE","5":"neuartiges","6":"neuartig","_rn_":"44"},{"1":"60285325","2":"FALSE","3":"-6","4":"FALSE","5":"Instrument","6":"Instrument","_rn_":"45"},{"1":"60285326","2":"FALSE","3":"-5","4":"FALSE","5":"in","6":"in","_rn_":"46"},{"1":"60285327","2":"FALSE","3":"-4","4":"FALSE","5":"einem","6":"ein","_rn_":"47"},{"1":"60285328","2":"FALSE","3":"-3","4":"FALSE","5":"Brief","6":"Brief","_rn_":"48"},{"1":"60285329","2":"FALSE","3":"-2","4":"FALSE","5":"gefordert","6":"fordern","_rn_":"49"},{"1":"60285330","2":"FALSE","3":"-1","4":"FALSE","5":":","6":":","_rn_":"50"},{"1":"60285331","2":"FALSE","3":"0","4":"FALSE","5":"Corona-Bonds","6":"Corona-Bonds","_rn_":"51"},{"1":"60285332","2":"FALSE","3":"1","4":"FALSE","5":",","6":",","_rn_":"52"},{"1":"60285333","2":"FALSE","3":"2","4":"FALSE","5":"also","6":"also","_rn_":"53"},{"1":"60285334","2":"FALSE","3":"3","4":"FALSE","5":"gemeinschaftlich","6":"gemeinschaftlich","_rn_":"54"},{"1":"60285335","2":"FALSE","3":"4","4":"FALSE","5":"herausgegebene","6":"herausgegeben","_rn_":"55"},{"1":"60285336","2":"FALSE","3":"5","4":"FALSE","5":"EU-Staatsanleihen","6":"EU-Staatsanleihe","_rn_":"56"},{"1":"60285337","2":"FALSE","3":"6","4":"FALSE","5":",","6":",","_rn_":"57"},{"1":"60285338","2":"FALSE","3":"7","4":"FALSE","5":"deren","6":"der","_rn_":"58"},{"1":"60285339","2":"FALSE","3":"8","4":"FALSE","5":"Einnahmen","6":"Einnahme","_rn_":"59"},{"1":"60285340","2":"FALSE","3":"9","4":"FALSE","5":"in","6":"in","_rn_":"60"},{"1":"60285341","2":"FALSE","3":"10","4":"FALSE","5":"die","6":"der","_rn_":"61"},{"1":"60285342","2":"FALSE","3":"11","4":"TRUE","5":"Pandemie-Bekämpfung","6":"Pandemie-Bekämpfung","_rn_":"62"},{"1":"60285343","2":"FALSE","3":"12","4":"TRUE","5":"fließen","6":"fließen","_rn_":"63"},{"1":"60285344","2":"FALSE","3":"13","4":"TRUE","5":".","6":".","_rn_":"64"},{"1":"60285345","2":"FALSE","3":"14","4":"TRUE","5":"Weil","6":"weil","_rn_":"65"},{"1":"60285346","2":"FALSE","3":"15","4":"TRUE","5":"auch","6":"auch","_rn_":"66"},{"1":"60285347","2":"FALSE","3":"16","4":"TRUE","5":"finanzstarke","6":"finanzstark","_rn_":"67"},{"1":"60285348","2":"FALSE","3":"17","4":"TRUE","5":"Staaten","6":"Staat","_rn_":"68"},{"1":"60285349","2":"FALSE","3":"18","4":"TRUE","5":"wie","6":"wie","_rn_":"69"},{"1":"60285350","2":"FALSE","3":"19","4":"TRUE","5":"Deutschland","6":"Deutschland","_rn_":"70"},{"1":"60285351","2":"FALSE","3":"20","4":"TRUE","5":"hinter","6":"hinter","_rn_":"71"},{"1":"60285352","2":"FALSE","3":"21","4":"TRUE","5":"diesen","6":"dieser","_rn_":"72"},{"1":"60285353","2":"FALSE","3":"22","4":"TRUE","5":"EU-Schuldscheinen","6":"EU-Schuldschein","_rn_":"73"},{"1":"60285354","2":"FALSE","3":"23","4":"TRUE","5":"stünden","6":"stehen","_rn_":"74"},{"1":"60285355","2":"FALSE","3":"24","4":"TRUE","5":",","6":",","_rn_":"75"},{"1":"60285356","2":"FALSE","3":"25","4":"TRUE","5":"würden","6":"werden","_rn_":"76"},{"1":"60285357","2":"FALSE","3":"26","4":"TRUE","5":"Anleger","6":"Anleger","_rn_":"77"},{"1":"60285358","2":"FALSE","3":"27","4":"TRUE","5":"sie","6":"sie","_rn_":"78"},{"1":"60285359","2":"FALSE","3":"28","4":"TRUE","5":"als","6":"als","_rn_":"79"},{"1":"60285360","2":"FALSE","3":"29","4":"TRUE","5":"sicher","6":"sicher","_rn_":"80"},{"1":"60285361","2":"FALSE","3":"30","4":"TRUE","5":"ansehen","6":"ansehen","_rn_":"81"},{"1":"60285362","2":"FALSE","3":"31","4":"TRUE","5":"–","6":"–","_rn_":"82"},{"1":"60285363","2":"FALSE","3":"32","4":"TRUE","5":"die","6":"der","_rn_":"83"},{"1":"60285364","2":"FALSE","3":"33","4":"TRUE","5":"Zinsen","6":"Zins","_rn_":"84"},{"1":"60285365","2":"FALSE","3":"34","4":"TRUE","5":"wären","6":"sein","_rn_":"85"},{"1":"60285366","2":"FALSE","3":"35","4":"TRUE","5":"niedrig","6":"niedrig","_rn_":"86"},{"1":"60285367","2":"FALSE","3":"36","4":"TRUE","5":".","6":".","_rn_":"87"},{"1":"60285368","2":"FALSE","3":"37","4":"TRUE","5":"Für","6":"für","_rn_":"88"},{"1":"60285369","2":"FALSE","3":"38","4":"TRUE","5":"Italien","6":"Italien","_rn_":"89"},{"1":"60285370","2":"FALSE","3":"39","4":"TRUE","5":"und","6":"und","_rn_":"90"},{"1":"60285371","2":"FALSE","3":"40","4":"TRUE","5":"Spanien","6":"Spanien","_rn_":"91"},{"1":"60285372","2":"FALSE","3":"41","4":"TRUE","5":"wären","6":"sein","_rn_":"92"},{"1":"60285373","2":"FALSE","3":"42","4":"TRUE","5":"solche","6":"solcher","_rn_":"93"},{"1":"60285374","2":"FALSE","3":"43","4":"TRUE","5":"Anleihen","6":"Anleihe","_rn_":"94"},{"1":"60285375","2":"FALSE","3":"44","4":"TRUE","5":"sehr","6":"sehr","_rn_":"95"},{"1":"60285376","2":"FALSE","3":"45","4":"TRUE","5":"vorteilhaft","6":"vorteilhaft","_rn_":"96"},{"1":"60285377","2":"FALSE","3":"46","4":"TRUE","5":"gegenüber","6":"gegenüber","_rn_":"97"},{"1":"60285378","2":"FALSE","3":"47","4":"TRUE","5":"einem","6":"ein","_rn_":"98"},{"1":"60285379","2":"FALSE","3":"48","4":"TRUE","5":"Kredit","6":"Kredit","_rn_":"99"},{"1":"60285380","2":"FALSE","3":"49","4":"TRUE","5":"vom","6":"von","_rn_":"100"},{"1":"60285381","2":"FALSE","3":"50","4":"TRUE","5":"Euro-Rettungsschirm","6":"Euro-Rettungsschirm","_rn_":"101"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>by default, you can paginate through random lines via <code>page_size</code> and <code>page_number</code>, see below for more details on filtering and sorting</li>
<li>note that when working on a subcorpus, the query must be defined on this subcorpus, e.g. in <code>"SZ-2020"</code>:</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb34"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a>query <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/assisted"</span>)) <span class="sc">|></span> </span>
<span id="cb34-2"><a href="#cb34-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">p =</span> <span class="st">"lemma"</span>, <span class="at">items =</span> <span class="fu">list</span>(<span class="st">"Corona-Bonds"</span>), <span class="at">corpus_id =</span> corpus.id, <span class="at">subcorpus_id =</span> subcorpus.id, <span class="at">s =</span> <span class="st">"text"</span>)) <span class="sc">|></span> </span>
<span id="cb34-3"><a href="#cb34-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb34-4"><a href="#cb34-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb34-5"><a href="#cb34-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb34-6"><a href="#cb34-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb34-7"><a href="#cb34-7" aria-hidden="true" tabindex="-1"></a>query.id <span class="ot"><-</span> query <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb35"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">page_size =</span> <span class="dv">1000</span>) <span class="sc">|></span> </span>
<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb35-5"><a href="#cb35-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb35-6"><a href="#cb35-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>) <span class="sc">|></span> </span>
<span id="cb35-7"><a href="#cb35-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"structural"</span>) <span class="sc">|></span> </span>
<span id="cb35-8"><a href="#cb35-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(text_date) <span class="sc">|></span> <span class="fu">table</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
20200325 20200328 20200330 20200331 20200401 20200402 20200403 20200404
1 1 1 4 5 11 8 16
20200406 20200407 20200408 20200409 20200416 20200417 20200418 20200420
19 7 11 4 3 1 3 4
20200423 20200424 20200427 20200428 20200504 20200505 20200506 20200508
1 4 1 2 1 1 1 3
20200511 20200512 20200513
1 1 1 </code></pre>
</div>
</div>
</section>
<section id="visualisation-semantic-map" class="level3" data-number="3.3.4">
<h3 data-number="3.3.4" class="anchored" data-anchor-id="visualisation-semantic-map"><span class="header-section-number">3.3.4</span> Visualisation (Semantic Map)</h3>
<ul>
<li>keyword tables (and collocation tables, see below) are visualised via semantic maps</li>
<li>semantic map = two-dimensional arrangement using coordinates + size = association measure</li>
<li>association measures and (initial) coordinates are provided by the API</li>
<li>semantic maps can e.g. display the top <code>page_size=200</code> items according to the <code>sort_by="conservative_log_ratio"</code> association measure
<ul>
<li>in an interactive frontend, the user should be able to set these parameters</li>
<li>we set <code>page_size=50</code> here, but a good frontend should make the map zoomable (best case: get more items until a user-defined cut-off)</li>
</ul></li>
<li>coordinates are provided automatically for all items</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb37"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a>kw.table.page <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/keyword/${kw.id}/items"</span>)) <span class="sc">|></span></span>
<span id="cb37-2"><a href="#cb37-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">sort_by =</span> <span class="st">"conservative_log_ratio"</span>, <span class="at">page_size =</span> <span class="dv">50</span>, <span class="at">page_number =</span> <span class="dv">1</span>) <span class="sc">|></span> </span>
<span id="cb37-3"><a href="#cb37-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb37-6"><a href="#cb37-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb37-7"><a href="#cb37-7" aria-hidden="true" tabindex="-1"></a>coordinates <span class="ot"><-</span> kw.table.page <span class="sc">|></span></span>
<span id="cb37-8"><a href="#cb37-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"coordinates"</span>) <span class="sc">|></span> </span>
<span id="cb37-9"><a href="#cb37-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>()</span>
<span id="cb37-10"><a href="#cb37-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb37-11"><a href="#cb37-11" aria-hidden="true" tabindex="-1"></a>coordinates</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["semantic_map_id"],"name":[2],"type":["int"],"align":["right"]},{"label":["x"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["x_user"],"name":[4],"type":["lgl"],"align":["right"]},{"label":["y"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["y_user"],"name":[6],"type":["lgl"],"align":["right"]}],"data":[{"1":"169,00","2":"18","3":"43.2669411","4":"NA","5":"6.0326576","6":"NA"},{"1":"85,50","2":"18","3":"38.0491714","4":"NA","5":"11.9198046","6":"NA"},{"1":"Ausgangsbeschränkung","2":"18","3":"2.1080570","4":"NA","5":"-7.7819161","6":"NA"},{"1":"Bahrain-McLaren","2":"18","3":"-3.3910918","4":"NA","5":"13.9763803","6":"NA"},{"1":"Beherbergungsverbot","2":"18","3":"0.9103778","4":"NA","5":"-11.9786682","6":"NA"},{"1":"Binnenmarktgesetz","2":"18","3":"1.5757723","4":"NA","5":"11.3859777","6":"NA"},{"1":"Clearview","2":"18","3":"-8.8795452","4":"NA","5":"5.8873920","6":"NA"},{"1":"Corona-Bonds","2":"18","3":"-16.1807995","4":"NA","5":"0.3040121","6":"NA"},{"1":"Corona-Epidemie","2":"18","3":"8.8437395","4":"NA","5":"23.7806015","6":"NA"},{"1":"Corona-Krise","2":"18","3":"8.9480495","4":"NA","5":"3.6623502","6":"NA"},{"1":"Coronakrise","2":"18","3":"8.9602041","4":"NA","5":"3.6822488","6":"NA"},{"1":"Coronavirus","2":"18","3":"-17.7051640","4":"NA","5":"-20.3220577","6":"NA"},{"1":"Coronavirus-Epidemie","2":"18","3":"-12.3679457","4":"NA","5":"-26.2485065","6":"NA"},{"1":"Coronavirus-Krise","2":"18","3":"-18.3918476","4":"NA","5":"-21.1900692","6":"NA"},{"1":"Coronavirus-Pandemie","2":"18","3":"-12.2357187","4":"NA","5":"-25.5979671","6":"NA"},{"1":"Desinfektionsmittel","2":"18","3":"1.0595554","4":"NA","5":"-9.5149622","6":"NA"},{"1":"Distancing","2":"18","3":"5.8767314","4":"NA","5":"18.7939243","6":"NA"},{"1":"Ederle","2":"18","3":"-20.8511353","4":"NA","5":"27.2694416","6":"NA"},{"1":"Epidemie","2":"18","3":"-12.6139584","4":"NA","5":"-26.5390701","6":"NA"},{"1":"FinCEN-File","2":"18","3":"5.4398179","4":"NA","5":"0.1322699","6":"NA"},{"1":"Gangelt","2":"18","3":"17.4997292","4":"NA","5":"4.4294801","6":"NA"},{"1":"Ganß","2":"18","3":"-17.8339825","4":"NA","5":"16.2166176","6":"NA"},{"1":"Geburtstagsgruß","2":"18","3":"-23.3065891","4":"NA","5":"4.2155113","6":"NA"},{"1":"Gehaltsverzicht","2":"18","3":"-7.7864013","4":"NA","5":"-13.7409868","6":"NA"},{"1":"Geisterspiel","2":"18","3":"-13.0202894","4":"NA","5":"-12.2553263","6":"NA"},{"1":"HOME-OFFICE-REDAKTION","2":"18","3":"-1.8945122","4":"NA","5":"20.9136524","6":"NA"},{"1":"Heinsberg","2":"18","3":"17.6426430","4":"NA","5":"4.3122048","6":"NA"},{"1":"Hubei","2":"18","3":"18.3460598","4":"NA","5":"19.0008965","6":"NA"},{"1":"Kaavan","2":"18","3":"-9.8062487","4":"NA","5":"27.5482578","6":"NA"},{"1":"Kabuga","2":"18","3":"-0.3754854","4":"NA","5":"15.8283529","6":"NA"},{"1":"Konjunkturpaket","2":"18","3":"-5.1830716","4":"NA","5":"-16.4763050","6":"NA"},{"1":"Kosanke","2":"18","3":"-16.4143887","4":"NA","5":"25.8414898","6":"NA"},{"1":"Lautwein","2":"18","3":"-16.7037640","4":"NA","5":"21.9489288","6":"NA"},{"1":"Mok","2":"18","3":"4.0995851","4":"NA","5":"10.8225489","6":"NA"},{"1":"Mulan","2":"18","3":"-7.1024661","4":"NA","5":"1.2436178","6":"NA"},{"1":"Mundschutz","2":"18","3":"9.5087013","4":"NA","5":"-13.7980671","6":"NA"},{"1":"NTT","2":"18","3":"4.6729379","4":"NA","5":"-2.0074635","6":"NA"},{"1":"RODEMANN","2":"18","3":"-15.1768675","4":"NA","5":"18.1368294","6":"NA"},{"1":"Reisewarnung","2":"18","3":"-6.1927357","4":"NA","5":"-21.4521866","6":"NA"},{"1":"Risikogebiet","2":"18","3":"-16.6145401","4":"NA","5":"-18.1615486","6":"NA"},{"1":"Rotunno","2":"18","3":"2.9546642","4":"NA","5":"30.6613560","6":"NA"},{"1":"Rubirola","2":"18","3":"-3.2951870","4":"NA","5":"15.8006067","6":"NA"},{"1":"Saisonabbruch","2":"18","3":"14.2717409","4":"NA","5":"4.7424560","6":"NA"},{"1":"Soleimani","2":"18","3":"7.0414100","4":"NA","5":"15.0045090","6":"NA"},{"1":"Soleimanis","2":"18","3":"7.1107931","4":"NA","5":"15.1213989","6":"NA"},{"1":"Tegnell","2":"18","3":"-10.2328415","4":"NA","5":"22.5406628","6":"NA"},{"1":"Verch","2":"18","3":"-21.3176670","4":"NA","5":"20.9663391","6":"NA"},{"1":"Viruskrise","2":"18","3":"-16.8287525","4":"NA","5":"-18.6760254","6":"NA"},{"1":"Wuhan","2":"18","3":"18.3528309","4":"NA","5":"18.9982395","6":"NA"},{"1":"allesgute","2":"18","3":"-11.3441477","4":"NA","5":"21.3225689","6":"NA"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>note that two types of coordinates are given:
<ul>
<li>initial coordinates as determined by the API</li>
<li>user coordinates that take precedence if defined via dragging on the semantic map by the user (see below)</li>
</ul></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb38"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a>scores <span class="ot"><-</span> kw.table.page <span class="sc">|></span></span>
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> </span>
<span id="cb38-3"><a href="#cb38-3" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"scores"</span>) <span class="sc">|></span> </span>
<span id="cb38-4"><a href="#cb38-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_rows</span>(<span class="at">.id =</span> <span class="st">"item"</span>) <span class="sc">|></span></span>
<span id="cb38-5"><a href="#cb38-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> measure, <span class="at">values_from =</span> score) <span class="sc">|></span> </span>
<span id="cb38-6"><a href="#cb38-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">item =</span> kw.table.page <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"item"</span>))</span>
<span id="cb38-7"><a href="#cb38-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb38-8"><a href="#cb38-8" aria-hidden="true" tabindex="-1"></a>map <span class="ot"><-</span> scores <span class="sc">|></span> </span>
<span id="cb38-9"><a href="#cb38-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(coordinates, <span class="at">by =</span> <span class="st">"item"</span>) <span class="sc">|></span> </span>
<span id="cb38-10"><a href="#cb38-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">x =</span> <span class="fu">if_else</span>(<span class="sc">!</span><span class="fu">is.na</span>(x_user), x_user, x),</span>
<span id="cb38-11"><a href="#cb38-11" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="fu">if_else</span>(<span class="sc">!</span><span class="fu">is.na</span>(y_user), y_user, y)) <span class="sc">|></span> </span>
<span id="cb38-12"><a href="#cb38-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(item, conservative_log_ratio, x, y)</span>
<span id="cb38-13"><a href="#cb38-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb38-14"><a href="#cb38-14" aria-hidden="true" tabindex="-1"></a>map <span class="sc">|></span> </span>
<span id="cb38-15"><a href="#cb38-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(conservative_log_ratio <span class="sc">></span> <span class="dv">0</span>) <span class="sc">|></span></span>
<span id="cb38-16"><a href="#cb38-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> x, <span class="at">y =</span> y, <span class="at">label =</span> item)) <span class="sc">+</span> </span>
<span id="cb38-17"><a href="#cb38-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_label_repel</span>(<span class="fu">aes</span>(<span class="at">size =</span> conservative_log_ratio), <span class="at">max.overlaps =</span> <span class="cn">Inf</span>, <span class="at">point.size =</span> <span class="cn">NA</span>, <span class="at">min.segment.length =</span> <span class="cn">Inf</span>) <span class="sc">+</span></span>
<span id="cb38-18"><a href="#cb38-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">xlab</span>(<span class="st">""</span>) <span class="sc">+</span> <span class="fu">ylab</span>(<span class="st">""</span>) <span class="sc">+</span></span>
<span id="cb38-19"><a href="#cb38-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(<span class="at">legend.position =</span> <span class="st">"bottom"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="cwb-cads-functionality_files/figure-html/unnamed-chunk-29-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<ul>
<li>we filter out all items with <code>conservative_log_ratio <= 0</code> here, which is probably reasonable
<ul>
<li>at the very least, items with <code>E11 >= O11</code> should not be displayed</li>
<li>no defaults implemented!
<ul>
<li>some reasonable defaults can be proposed though</li>
<li>best case scenario: user-defined</li>
</ul></li>
</ul></li>
</ul>
</section>
</section>
</section>
<section id="query" class="level1" data-number="4">
<h1 data-number="4"><span class="header-section-number">4</span> Query</h1>
<section id="creation-3" class="level2" data-number="4.1">
<h2 data-number="4.1" class="anchored" data-anchor-id="creation-3"><span class="header-section-number">4.1</span> Creation</h2>
<ul>
<li>here: CQP query in a (sub-)corpus, i.e. we create a query using the full query end point here</li>
<li>for assisted mode, see above</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb39"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb39-1"><a href="#cb39-1" aria-hidden="true" tabindex="-1"></a>query <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/query/"</span>) <span class="sc">|></span> </span>
<span id="cb39-2"><a href="#cb39-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb39-3"><a href="#cb39-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id, <span class="at">cqp_query =</span> <span class="st">'[lemma="Klimawandel"%cd] | [lemma="global"] [lemma="Erwärmung"]'</span>)) <span class="sc">|></span> </span>
<span id="cb39-4"><a href="#cb39-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb39-5"><a href="#cb39-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb39-6"><a href="#cb39-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-7"><a href="#cb39-7" aria-hidden="true" tabindex="-1"></a>query.id <span class="ot"><-</span> query <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="concordancing" class="level2" data-number="4.2">
<h2 data-number="4.2" class="anchored" data-anchor-id="concordancing"><span class="header-section-number">4.2</span> Concordancing</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb40"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb40-1"><a href="#cb40-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb40-2"><a href="#cb40-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb40-3"><a href="#cb40-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb40-4"><a href="#cb40-4" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb40-5"><a href="#cb40-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb41"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb41-1"><a href="#cb41-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="sc">|></span> </span>
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"tokens"</span>) <span class="sc">|></span> </span>
<span id="cb41-3"><a href="#cb41-3" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="dv">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["cpos"],"name":[1],"type":["int"],"align":["right"]},{"label":["is_filter_item"],"name":[2],"type":["lgl"],"align":["right"]},{"label":["offset"],"name":[3],"type":["int"],"align":["right"]},{"label":["out_of_window"],"name":[4],"type":["lgl"],"align":["right"]},{"label":["primary"],"name":[5],"type":["chr"],"align":["left"]},{"label":["secondary"],"name":[6],"type":["chr"],"align":["left"]}],"data":[{"1":"2171","2":"FALSE","3":"-50","4":"TRUE","5":"dem","6":"der","_rn_":"1"},{"1":"2172","2":"FALSE","3":"-49","4":"TRUE","5":"Erdreich","6":"Erdreich","_rn_":"2"},{"1":"2173","2":"FALSE","3":"-48","4":"TRUE","5":"unter","6":"unter","_rn_":"3"},{"1":"2174","2":"FALSE","3":"-47","4":"TRUE","5":"dem","6":"der","_rn_":"4"},{"1":"2175","2":"FALSE","3":"-46","4":"TRUE","5":"Großraum","6":"Großraum","_rn_":"5"},{"1":"2176","2":"FALSE","3":"-45","4":"TRUE","5":"Jakarta","6":"Jakarta","_rn_":"6"},{"1":"2177","2":"FALSE","3":"-44","4":"TRUE","5":".","6":".","_rn_":"7"},{"1":"2178","2":"FALSE","3":"-43","4":"TRUE","5":"Seit","6":"seit","_rn_":"8"},{"1":"2179","2":"FALSE","3":"-42","4":"TRUE","5":"Jahrzehnten","6":"Jahrzehnt","_rn_":"9"},{"1":"2180","2":"FALSE","3":"-41","4":"TRUE","5":"pumpen","6":"pumpen","_rn_":"10"},{"1":"2181","2":"FALSE","3":"-40","4":"TRUE","5":"die","6":"der","_rn_":"11"},{"1":"2182","2":"FALSE","3":"-39","4":"TRUE","5":"Menschen","6":"Mensch","_rn_":"12"},{"1":"2183","2":"FALSE","3":"-38","4":"TRUE","5":"dort","6":"dort","_rn_":"13"},{"1":"2184","2":"FALSE","3":"-37","4":"TRUE","5":"Wasser","6":"Wasser","_rn_":"14"},{"1":"2185","2":"FALSE","3":"-36","4":"TRUE","5":"aus","6":"aus","_rn_":"15"},{"1":"2186","2":"FALSE","3":"-35","4":"TRUE","5":"Brunnen","6":"Brunnen","_rn_":"16"},{"1":"2187","2":"FALSE","3":"-34","4":"TRUE","5":"an","6":"an","_rn_":"17"},{"1":"2188","2":"FALSE","3":"-33","4":"TRUE","5":"die","6":"der","_rn_":"18"},{"1":"2189","2":"FALSE","3":"-32","4":"TRUE","5":"Oberfläche","6":"Oberfläche","_rn_":"19"},{"1":"2190","2":"FALSE","3":"-31","4":"TRUE","5":".","6":".","_rn_":"20"},{"1":"2191","2":"FALSE","3":"-30","4":"TRUE","5":"Und","6":"und","_rn_":"21"},{"1":"2192","2":"FALSE","3":"-29","4":"TRUE","5":"so","6":"so","_rn_":"22"},{"1":"2193","2":"FALSE","3":"-28","4":"TRUE","5":"senkt","6":"senken","_rn_":"23"},{"1":"2194","2":"FALSE","3":"-27","4":"TRUE","5":"sich","6":"sich","_rn_":"24"},{"1":"2195","2":"FALSE","3":"-26","4":"TRUE","5":"die","6":"der","_rn_":"25"},{"1":"2196","2":"FALSE","3":"-25","4":"TRUE","5":"Stadt","6":"Stadt","_rn_":"26"},{"1":"2197","2":"FALSE","3":"-24","4":"TRUE","5":"unter","6":"unter","_rn_":"27"},{"1":"2198","2":"FALSE","3":"-23","4":"TRUE","5":"der","6":"der","_rn_":"28"},{"1":"2199","2":"FALSE","3":"-22","4":"TRUE","5":"Betonlast","6":"Betonlast","_rn_":"29"},{"1":"2200","2":"FALSE","3":"-21","4":"TRUE","5":"immer","6":"immer","_rn_":"30"},{"1":"2201","2":"FALSE","3":"-20","4":"TRUE","5":"tiefer","6":"tief","_rn_":"31"},{"1":"2202","2":"FALSE","3":"-19","4":"TRUE","5":".","6":".","_rn_":"32"},{"1":"2203","2":"FALSE","3":"-18","4":"TRUE","5":"Schon","6":"schon","_rn_":"33"},{"1":"2204","2":"FALSE","3":"-17","4":"TRUE","5":"jetzt","6":"jetzt","_rn_":"34"},{"1":"2205","2":"FALSE","3":"-16","4":"TRUE","5":"liegen","6":"liegen","_rn_":"35"},{"1":"2206","2":"FALSE","3":"-15","4":"TRUE","5":"40","6":"40","_rn_":"36"},{"1":"2207","2":"FALSE","3":"-14","4":"TRUE","5":"Prozent","6":"Prozent","_rn_":"37"},{"1":"2208","2":"FALSE","3":"-13","4":"TRUE","5":"der","6":"der","_rn_":"38"},{"1":"2209","2":"FALSE","3":"-12","4":"TRUE","5":"Metropole","6":"Metropole","_rn_":"39"},{"1":"2210","2":"FALSE","3":"-11","4":"TRUE","5":"unter","6":"unter","_rn_":"40"},{"1":"2211","2":"FALSE","3":"-10","4":"FALSE","5":"dem","6":"der","_rn_":"41"},{"1":"2212","2":"FALSE","3":"-9","4":"FALSE","5":"Meeresspiegel","6":"Meeresspiegel","_rn_":"42"},{"1":"2213","2":"FALSE","3":"-8","4":"FALSE","5":".","6":".","_rn_":"43"},{"1":"2214","2":"FALSE","3":"-7","4":"FALSE","5":"Weil","6":"weil","_rn_":"44"},{"1":"2215","2":"FALSE","3":"-6","4":"FALSE","5":"nun","6":"nun","_rn_":"45"},{"1":"2216","2":"FALSE","3":"-5","4":"FALSE","5":"auch","6":"auch","_rn_":"46"},{"1":"2217","2":"FALSE","3":"-4","4":"FALSE","5":"noch","6":"noch","_rn_":"47"},{"1":"2218","2":"FALSE","3":"-3","4":"FALSE","5":"die","6":"der","_rn_":"48"},{"1":"2219","2":"FALSE","3":"-2","4":"FALSE","5":"Risiken","6":"Risiko","_rn_":"49"},{"1":"2220","2":"FALSE","3":"-1","4":"FALSE","5":"des","6":"der","_rn_":"50"},{"1":"2221","2":"FALSE","3":"0","4":"FALSE","5":"Klimawandels","6":"Klimawandel","_rn_":"51"},{"1":"2222","2":"FALSE","3":"1","4":"FALSE","5":"hinzukommen","6":"hinkommen","_rn_":"52"},{"1":"2223","2":"FALSE","3":"2","4":"FALSE","5":",","6":",","_rn_":"53"},{"1":"2224","2":"FALSE","3":"3","4":"FALSE","5":"muss","6":"müssen","_rn_":"54"},{"1":"2225","2":"FALSE","3":"4","4":"FALSE","5":"sich","6":"sich","_rn_":"55"},{"1":"2226","2":"FALSE","3":"5","4":"FALSE","5":"Jakarta","6":"Jakarta","_rn_":"56"},{"1":"2227","2":"FALSE","3":"6","4":"FALSE","5":"auf","6":"auf","_rn_":"57"},{"1":"2228","2":"FALSE","3":"7","4":"FALSE","5":"stärkere","6":"stark","_rn_":"58"},{"1":"2229","2":"FALSE","3":"8","4":"FALSE","5":"Sturmfluten","6":"Sturmflut","_rn_":"59"},{"1":"2230","2":"FALSE","3":"9","4":"FALSE","5":"und","6":"und","_rn_":"60"},{"1":"2231","2":"FALSE","3":"10","4":"FALSE","5":"einen","6":"ein","_rn_":"61"},{"1":"2232","2":"FALSE","3":"11","4":"TRUE","5":"steigenden","6":"steigend","_rn_":"62"},{"1":"2233","2":"FALSE","3":"12","4":"TRUE","5":"Meeresspiegel","6":"Meeresspiegel","_rn_":"63"},{"1":"2234","2":"FALSE","3":"13","4":"TRUE","5":"einstellen","6":"einstellen","_rn_":"64"},{"1":"2235","2":"FALSE","3":"14","4":"TRUE","5":".","6":".","_rn_":"65"},{"1":"2236","2":"FALSE","3":"15","4":"TRUE","5":"Alles","6":"alle","_rn_":"66"},{"1":"2237","2":"FALSE","3":"16","4":"TRUE","5":"zusammen","6":"zusammen","_rn_":"67"},{"1":"2238","2":"FALSE","3":"17","4":"TRUE","5":"ergibt","6":"ergeben","_rn_":"68"},{"1":"2239","2":"FALSE","3":"18","4":"TRUE","5":"eine","6":"ein","_rn_":"69"},{"1":"2240","2":"FALSE","3":"19","4":"TRUE","5":"düstere","6":"düster","_rn_":"70"},{"1":"2241","2":"FALSE","3":"20","4":"TRUE","5":"Prognose","6":"Prognose","_rn_":"71"},{"1":"2242","2":"FALSE","3":"21","4":"TRUE","5":".","6":".","_rn_":"72"},{"1":"2243","2":"FALSE","3":"22","4":"TRUE","5":"Planungen","6":"Planung","_rn_":"73"},{"1":"2244","2":"FALSE","3":"23","4":"TRUE","5":"für","6":"für","_rn_":"74"},{"1":"2245","2":"FALSE","3":"24","4":"TRUE","5":"eine","6":"ein","_rn_":"75"},{"1":"2246","2":"FALSE","3":"25","4":"TRUE","5":"riesige","6":"riesig","_rn_":"76"},{"1":"2247","2":"FALSE","3":"26","4":"TRUE","5":"Mauer","6":"Mauer","_rn_":"77"},{"1":"2248","2":"FALSE","3":"27","4":"TRUE","5":"im","6":"in","_rn_":"78"},{"1":"2249","2":"FALSE","3":"28","4":"TRUE","5":"Meer","6":"Meer","_rn_":"79"},{"1":"2250","2":"FALSE","3":"29","4":"TRUE","5":",","6":",","_rn_":"80"},{"1":"2251","2":"FALSE","3":"30","4":"TRUE","5":"die","6":"der","_rn_":"81"},{"1":"2252","2":"FALSE","3":"31","4":"TRUE","5":"als","6":"als","_rn_":"82"},{"1":"2253","2":"FALSE","3":"32","4":"TRUE","5":"Schutzwall","6":"Schutzwall","_rn_":"83"},{"1":"2254","2":"FALSE","3":"33","4":"TRUE","5":"dienen","6":"dienen","_rn_":"84"},{"1":"2255","2":"FALSE","3":"34","4":"TRUE","5":"könnte","6":"können","_rn_":"85"},{"1":"2256","2":"FALSE","3":"35","4":"TRUE","5":",","6":",","_rn_":"86"},{"1":"2257","2":"FALSE","3":"36","4":"TRUE","5":"sind","6":"sein","_rn_":"87"},{"1":"2258","2":"FALSE","3":"37","4":"TRUE","5":"umstritten","6":"umstritten","_rn_":"88"},{"1":"2259","2":"FALSE","3":"38","4":"TRUE","5":"und","6":"und","_rn_":"89"},{"1":"2260","2":"FALSE","3":"39","4":"TRUE","5":"kommen","6":"kommen","_rn_":"90"},{"1":"2261","2":"FALSE","3":"40","4":"TRUE","5":"nur","6":"nur","_rn_":"91"},{"1":"2262","2":"FALSE","3":"41","4":"TRUE","5":"schleppend","6":"schleppend","_rn_":"92"},{"1":"2263","2":"FALSE","3":"42","4":"TRUE","5":"voran","6":"voran","_rn_":"93"},{"1":"2264","2":"FALSE","3":"43","4":"TRUE","5":".","6":".","_rn_":"94"},{"1":"2265","2":"FALSE","3":"44","4":"TRUE","5":"Doch","6":"doch","_rn_":"95"},{"1":"2266","2":"FALSE","3":"45","4":"TRUE","5":"das","6":"der","_rn_":"96"},{"1":"2267","2":"FALSE","3":"46","4":"TRUE","5":"ist","6":"sein","_rn_":"97"},{"1":"2268","2":"FALSE","3":"47","4":"TRUE","5":"noch","6":"noch","_rn_":"98"},{"1":"2269","2":"FALSE","3":"48","4":"TRUE","5":"nicht","6":"nicht","_rn_":"99"},{"1":"2270","2":"FALSE","3":"49","4":"TRUE","5":"alles","6":"alle","_rn_":"100"},{"1":"2271","2":"FALSE","3":"50","4":"TRUE","5":".","6":".","_rn_":"101"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<section id="context-settings" class="level3" data-number="4.2.1">
<h3 data-number="4.2.1" class="anchored" data-anchor-id="context-settings"><span class="header-section-number">4.2.1</span> Context Settings</h3>
<ul>
<li>you can provide three parameters to define how much context is displayed (and what should be treated as <code>out_of_window</code>)
<ul>
<li><code>window</code>: number of tokens left and right of the matches considered as immediate context</li>
<li><code>extended_window</code>: maximum number of tokens totally returned</li>
<li><code>context_break</code>: structural attribute to delimit context</li>
</ul></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb42"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb42-3"><a href="#cb42-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">window =</span> <span class="dv">5</span>, <span class="at">extended_window =</span> <span class="dv">10</span>, <span class="at">context_break =</span> <span class="st">'s'</span>) <span class="sc">|></span> </span>
<span id="cb42-4"><a href="#cb42-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb42-5"><a href="#cb42-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb42-6"><a href="#cb42-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>) <span class="sc">|></span> </span>
<span id="cb42-7"><a href="#cb42-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"tokens"</span>) <span class="sc">|></span> </span>
<span id="cb42-8"><a href="#cb42-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="dv">10</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["cpos"],"name":[1],"type":["int"],"align":["right"]},{"label":["is_filter_item"],"name":[2],"type":["lgl"],"align":["right"]},{"label":["offset"],"name":[3],"type":["int"],"align":["right"]},{"label":["out_of_window"],"name":[4],"type":["lgl"],"align":["right"]},{"label":["primary"],"name":[5],"type":["chr"],"align":["left"]},{"label":["secondary"],"name":[6],"type":["chr"],"align":["left"]}],"data":[{"1":"277066","2":"FALSE","3":"-4","4":"FALSE","5":"Vielleicht","6":"vielleicht","_rn_":"1"},{"1":"277067","2":"FALSE","3":"-3","4":"FALSE","5":"lag","6":"liegen","_rn_":"2"},{"1":"277068","2":"FALSE","3":"-2","4":"FALSE","5":"es","6":"es","_rn_":"3"},{"1":"277069","2":"FALSE","3":"-1","4":"FALSE","5":"am","6":"an","_rn_":"4"},{"1":"277070","2":"FALSE","3":"0","4":"FALSE","5":"Klimawandel","6":"Klimawandel","_rn_":"5"},{"1":"277071","2":"FALSE","3":"1","4":"FALSE","5":",","6":",","_rn_":"6"},{"1":"277072","2":"FALSE","3":"2","4":"FALSE","5":"dass","6":"dass","_rn_":"7"},{"1":"277073","2":"FALSE","3":"3","4":"FALSE","5":"die","6":"der","_rn_":"8"},{"1":"277074","2":"FALSE","3":"4","4":"FALSE","5":"Pflanze","6":"Pflanze","_rn_":"9"},{"1":"277075","2":"FALSE","3":"5","4":"FALSE","5":"am","6":"an","_rn_":"10"},{"1":"277076","2":"FALSE","3":"6","4":"TRUE","5":"Toten","6":"tot","_rn_":"11"},{"1":"277077","2":"FALSE","3":"7","4":"TRUE","5":"Meer","6":"Meer","_rn_":"12"},{"1":"277078","2":"FALSE","3":"8","4":"TRUE","5":"ausstarb","6":"aussterben","_rn_":"13"},{"1":"277079","2":"FALSE","3":"9","4":"TRUE","5":",","6":",","_rn_":"14"},{"1":"277080","2":"FALSE","3":"10","4":"TRUE","5":"vielleicht","6":"vielleicht","_rn_":"15"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
</section>
<section id="filtering" class="level3" data-number="4.2.2">
<h3 data-number="4.2.2" class="anchored" data-anchor-id="filtering"><span class="header-section-number">4.2.2</span> Filtering</h3>
<ul>
<li>we can filter concordance lines according to certain items in the context</li>
<li>this only takes into consideration items in the immediate context (i.e. where <code>out_of_window=FALSE</code>)</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb43"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a>item <span class="ot">=</span> <span class="st">"Erderwärmung"</span></span>
<span id="cb43-2"><a href="#cb43-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb43-3"><a href="#cb43-3" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb43-4"><a href="#cb43-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">filter_item =</span> item, <span class="at">filter_item_p_att =</span> <span class="st">'lemma'</span>, <span class="at">extended_window =</span> <span class="dv">10</span>, <span class="at">context_break =</span> <span class="st">'s'</span>) <span class="sc">|></span> </span>
<span id="cb43-5"><a href="#cb43-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb43-6"><a href="#cb43-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb43-7"><a href="#cb43-7" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb43-8"><a href="#cb43-8" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb44"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb44-1"><a href="#cb44-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="sc">|></span> </span>
<span id="cb44-2"><a href="#cb44-2" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"tokens"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract</span>(<span class="dv">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[[1]]
cpos is_filter_item offset out_of_window primary secondary
1 11155951 FALSE -9 FALSE In in
2 11155952 FALSE -8 FALSE Niger Niger
3 11155953 FALSE -7 FALSE und und
4 11155954 FALSE -6 FALSE damit damit
5 11155955 FALSE -5 FALSE mitten mitten
6 11155956 FALSE -4 FALSE in in
7 11155957 FALSE -3 FALSE der der
8 11155958 FALSE -2 FALSE Sahelzone Sahelzone
9 11155959 FALSE -1 FALSE sind sein
10 11155960 FALSE 0 FALSE Klimawandel Klimawandel
11 11155961 FALSE 1 FALSE und und
12 11155962 FALSE 2 FALSE Erderwärmung Erderwärmung
13 11155963 FALSE 3 FALSE in in
14 11155964 FALSE 4 FALSE voller voll
15 11155965 FALSE 5 FALSE Härte Härte
16 11155966 FALSE 6 FALSE zu zu
17 11155967 FALSE 7 FALSE spüren spüren
18 11155968 FALSE 8 FALSE . .</code></pre>
</div>
</div>
</section>
<section id="sorting" class="level3" data-number="4.2.3">
<h3 data-number="4.2.3" class="anchored" data-anchor-id="sorting"><span class="header-section-number">4.2.3</span> Sorting</h3>
<ul>
<li>by default, the API provides concordances in randomised order</li>
<li>use <code>sort_order="first"</code> to sort by corpus occurrence</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb46"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb46-1"><a href="#cb46-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb46-2"><a href="#cb46-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">sort_order =</span> <span class="st">'first'</span>, <span class="at">page_size =</span> <span class="dv">20</span>) <span class="sc">|></span> </span>
<span id="cb46-3"><a href="#cb46-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb46-4"><a href="#cb46-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb46-5"><a href="#cb46-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb46-6"><a href="#cb46-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb47"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb47-1"><a href="#cb47-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="sc">|></span> <span class="fu">pull</span>(match_id)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] 2221 16213 189455 213617 216094 227793 240348 243161 250115 277070
[11] 281021 608097 630500 671652 682625 699292 742615 948260 948478 948857</code></pre>
</div>
</div>
<ul>
<li>you can also use <code>sort_order="ascending"</code> or <code>sort_order="descending"</code></li>
<li>this has to be combined with <code>sort_by</code> (p-attribute) and <code>sort_by_offset</code> (relative to match..matchend)</li>
<li>the following request retrieves e.g. concordance lines sorted by lemmata next to the match</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb49"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb49-1"><a href="#cb49-1" aria-hidden="true" tabindex="-1"></a>concordance.lines <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/concordance"</span>)) <span class="sc">|></span> </span>
<span id="cb49-2"><a href="#cb49-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">sort_by_offset =</span> <span class="dv">1</span>, <span class="at">sort_by_p_att =</span> <span class="st">'lemma'</span>, <span class="at">sort_order =</span> <span class="st">'ascending'</span>, <span class="at">page_number =</span> <span class="dv">10</span>, <span class="at">page_size =</span> <span class="dv">500</span>) <span class="sc">|></span> </span>
<span id="cb49-3"><a href="#cb49-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb49-4"><a href="#cb49-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb49-5"><a href="#cb49-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb49-6"><a href="#cb49-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb50"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb50-1"><a href="#cb50-1" aria-hidden="true" tabindex="-1"></a>lemmata <span class="ot"><-</span> <span class="fu">c</span>()</span>
<span id="cb50-2"><a href="#cb50-2" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (i <span class="cf">in</span> <span class="dv">50</span><span class="sc">:</span><span class="dv">150</span>){</span>
<span id="cb50-3"><a href="#cb50-3" aria-hidden="true" tabindex="-1"></a> lemma <span class="ot"><-</span> concordance.lines <span class="sc">|></span> </span>
<span id="cb50-4"><a href="#cb50-4" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"tokens"</span>) <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(i) <span class="sc">|></span> </span>
<span id="cb50-5"><a href="#cb50-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(offset <span class="sc">==</span> <span class="dv">1</span>) <span class="sc">|></span> <span class="fu">pull</span>(secondary)</span>
<span id="cb50-6"><a href="#cb50-6" aria-hidden="true" tabindex="-1"></a> lemmata <span class="ot"><-</span> <span class="fu">c</span>(lemmata, lemma)</span>
<span id="cb50-7"><a href="#cb50-7" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb50-8"><a href="#cb50-8" aria-hidden="true" tabindex="-1"></a>lemmata</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] "oder" "oder" "oder" "oder"
[5] "offenbar" "offenbaren" "oft" "oft"
[9] "oftmals" "ohne" "ohne" "ohne"
[13] "ohnehin" "ohnehin" "ohnehin" "operieren"
[17] "optimistisch" "passen" "passieren" "passieren"
[21] "pauschal" "pausieren" "peinlich" "persönlich"
[25] "plus" "plus" "plötzlich" "plötzlich"
[29] "politisch" "politisch" "praktisch" "praktisch"
[33] "praktisch" "praktisch" "pressieren" "produzieren"
[37] "profilieren" "profitier" "profitier" "profitier"
[41] "profitier" "profitier" "protestieren" "protestieren"
[45] "protestieren" "protestieren" "provozieren" "prägen"
[49] "prägen" "prägen" "prägen" "prägen"
[53] "prägen" "prägen" "prägen" "präsentieren"
[57] "präzise" "quasi" "radikal" "rasant"
[61] "rasch" "raten" "rausschmeißen" "reagieren"
[65] "reagieren" "reagieren" "reagieren" "reagieren"
[69] "reagieren" "reagieren" "reagieren" "reagieren"
[73] "reagieren" "reagieren" "reagieren" "reagieren"
[77] "reagieren" "reagieren" "real" "real"
[81] "real" "rechnen" "reden" "reden"
[85] "reden" "reden" "reden" "reduzieren"
[89] "reduzieren" "referieren" "relevant" "respektieren"
[93] "retten" "richten" "richten" "richten"
[97] "rücken" "rüsten" "rüsten" "rüsten"
[101] "sagen" </code></pre>
</div>
</div>
</section>
</section>
<section id="breakdown" class="level2" data-number="4.3">
<h2 data-number="4.3" class="anchored" data-anchor-id="breakdown"><span class="header-section-number">4.3</span> Breakdown</h2>
<ul>
<li>breakdown of the query shows which items were found (and their absolute and relative frequency (instances per million (ipm) in the corpus))</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb52"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a>breakdown <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${query.id}/breakdown"</span>)) <span class="sc">|></span> </span>
<span id="cb52-2"><a href="#cb52-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb52-3"><a href="#cb52-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">p =</span> <span class="st">"lemma"</span>) <span class="sc">|></span> </span>
<span id="cb52-4"><a href="#cb52-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb52-5"><a href="#cb52-5" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb52-6"><a href="#cb52-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> </span>
<span id="cb52-7"><a href="#cb52-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb53"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb53-1"><a href="#cb53-1" aria-hidden="true" tabindex="-1"></a>breakdown<span class="sc">|></span> <span class="fu">select</span>(item, ipm, freq, nr_tokens)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["ipm"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["freq"],"name":[3],"type":["int"],"align":["right"]},{"label":["nr_tokens"],"name":[4],"type":["int"],"align":["right"]}],"data":[{"1":"KLIMAWANDEL","2":"0.1172408","3":"15","4":"127941850"},{"1":"Klimawandel","2":"55.0484458","3":"7043","4":"127941850"},{"1":"global Erwärmung","2":"1.3287286","3":"170","4":"127941850"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>note that nr_tokens (and ipm) is calculated taken the subcorpus size into account (if query is run on subcorpus)</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb54"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb54-1"><a href="#cb54-1" aria-hidden="true" tabindex="-1"></a>subcorpus.query.id <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/query/"</span>) <span class="sc">|></span> </span>
<span id="cb54-2"><a href="#cb54-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb54-3"><a href="#cb54-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id, <span class="at">subcorpus_id =</span> subcorpus.id, <span class="at">cqp_query =</span> <span class="st">'[lemma="Klimawandel"%cd] | [lemma="global"] [lemma="Erwärmung"]'</span>)) <span class="sc">|></span> </span>
<span id="cb54-4"><a href="#cb54-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb54-5"><a href="#cb54-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span></span>
<span id="cb54-6"><a href="#cb54-6" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span>
<span id="cb54-7"><a href="#cb54-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-8"><a href="#cb54-8" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${subcorpus.query.id}/breakdown"</span>)) <span class="sc">|></span> </span>
<span id="cb54-9"><a href="#cb54-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb54-10"><a href="#cb54-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">p =</span> <span class="st">"lemma"</span>) <span class="sc">|></span> </span>
<span id="cb54-11"><a href="#cb54-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb54-12"><a href="#cb54-12" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>() <span class="sc">|></span> </span>
<span id="cb54-13"><a href="#cb54-13" aria-hidden="true" tabindex="-1"></a> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</span>) <span class="sc">|></span> </span>
<span id="cb54-14"><a href="#cb54-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>() <span class="sc">|></span> </span>
<span id="cb54-15"><a href="#cb54-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(item, ipm, freq, nr_tokens)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["item"],"name":[1],"type":["chr"],"align":["left"]},{"label":["ipm"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["freq"],"name":[3],"type":["int"],"align":["right"]},{"label":["nr_tokens"],"name":[4],"type":["int"],"align":["right"]}],"data":[{"1":"KLIMAWANDEL","2":"0.07986138","3":"2","4":"25043393"},{"1":"Klimawandel","2":"51.67031480","3":"1294","4":"25043393"},{"1":"global Erwärmung","2":"1.15799005","3":"29","4":"25043393"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>