-
Notifications
You must be signed in to change notification settings - Fork 0
/
cwb-cads-discoursemes.html
2603 lines (2525 loc) · 697 KB
/
cwb-cads-discoursemes.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-11-20">
<title>cwb-cads discoursemes</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-discoursemes_files/libs/clipboard/clipboard.min.js"></script>
<script src="cwb-cads-discoursemes_files/libs/quarto-html/quarto.js"></script>
<script src="cwb-cads-discoursemes_files/libs/quarto-html/popper.min.js"></script>
<script src="cwb-cads-discoursemes_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="cwb-cads-discoursemes_files/libs/quarto-html/anchor.min.js"></script>
<link href="cwb-cads-discoursemes_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="cwb-cads-discoursemes_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="cwb-cads-discoursemes_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="cwb-cads-discoursemes_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="cwb-cads-discoursemes_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<link href="cwb-cads-discoursemes_files/libs/pagedtable-1.1/css/pagedtable.css" rel="stylesheet">
<script src="cwb-cads-discoursemes_files/libs/pagedtable-1.1/js/pagedtable.js"></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="#discoursemes" id="toc-discoursemes" class="nav-link" data-scroll-target="#discoursemes"><span class="header-section-number">2</span> Discoursemes</a>
<ul class="collapse">
<li><a href="#descriptions-realisations" id="toc-descriptions-realisations" class="nav-link" data-scroll-target="#descriptions-realisations"><span class="header-section-number">2.1</span> Descriptions & Realisations</a></li>
<li><a href="#discourseme-template" id="toc-discourseme-template" class="nav-link" data-scroll-target="#discourseme-template"><span class="header-section-number">2.2</span> Discourseme Template</a></li>
</ul></li>
<li><a href="#discourseme-constellations" id="toc-discourseme-constellations" class="nav-link" data-scroll-target="#discourseme-constellations"><span class="header-section-number">3</span> Discourseme Constellations</a>
<ul class="collapse">
<li><a href="#constellation-descriptions" id="toc-constellation-descriptions" class="nav-link" data-scroll-target="#constellation-descriptions"><span class="header-section-number">3.1</span> Constellation Descriptions</a></li>
<li><a href="#concordancing" id="toc-concordancing" class="nav-link" data-scroll-target="#concordancing"><span class="header-section-number">3.2</span> Concordancing</a></li>
<li><a href="#collocation-analysis" id="toc-collocation-analysis" class="nav-link" data-scroll-target="#collocation-analysis"><span class="header-section-number">3.3</span> Collocation Analysis</a>
<ul class="collapse">
<li><a href="#visualisation" id="toc-visualisation" class="nav-link" data-scroll-target="#visualisation"><span class="header-section-number">3.3.1</span> Visualisation</a></li>
<li><a href="#second-order-collocation" id="toc-second-order-collocation" class="nav-link" data-scroll-target="#second-order-collocation"><span class="header-section-number">3.3.2</span> Second-order Collocation</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.4</span> Keyword Analysis</a>
<ul class="collapse">
<li><a href="#visualisation-1" id="toc-visualisation-1" class="nav-link" data-scroll-target="#visualisation-1"><span class="header-section-number">3.4.1</span> Visualisation</a></li>
</ul></li>
<li><a href="#associations" id="toc-associations" class="nav-link" data-scroll-target="#associations"><span class="header-section-number">3.5</span> Associations</a></li>
</ul></li>
<li><a href="#iterative-work-on-semantic-maps" id="toc-iterative-work-on-semantic-maps" class="nav-link" data-scroll-target="#iterative-work-on-semantic-maps"><span class="header-section-number">4</span> Iterative Work on Semantic Maps</a>
<ul class="collapse">
<li><a href="#updating-discourseme-coordinates" id="toc-updating-discourseme-coordinates" class="nav-link" data-scroll-target="#updating-discourseme-coordinates"><span class="header-section-number">4.1</span> Updating Discourseme Coordinates</a></li>
<li><a href="#adding-discoursemes" id="toc-adding-discoursemes" class="nav-link" data-scroll-target="#adding-discoursemes"><span class="header-section-number">4.2</span> Adding Discoursemes</a>
<ul class="collapse">
<li><a href="#convenience-endpoint-for-drag-drop" id="toc-convenience-endpoint-for-drag-drop" class="nav-link" data-scroll-target="#convenience-endpoint-for-drag-drop"><span class="header-section-number">4.2.1</span> Convenience Endpoint for Drag & Drop</a></li>
<li><a href="#keyword-analysis-1" id="toc-keyword-analysis-1" class="nav-link" data-scroll-target="#keyword-analysis-1"><span class="header-section-number">4.2.2</span> Keyword Analysis</a></li>
<li><a href="#associations-1" id="toc-associations-1" class="nav-link" data-scroll-target="#associations-1"><span class="header-section-number">4.2.3</span> Associations</a></li>
<li><a href="#concordance" id="toc-concordance" class="nav-link" data-scroll-target="#concordance"><span class="header-section-number">4.2.4</span> Concordance</a></li>
</ul></li>
<li><a href="#removing-discoursemes" id="toc-removing-discoursemes" class="nav-link" data-scroll-target="#removing-discoursemes"><span class="header-section-number">4.3</span> Removing Discoursemes</a>
<ul class="collapse">
<li><a href="#associations-2" id="toc-associations-2" class="nav-link" data-scroll-target="#associations-2"><span class="header-section-number">4.3.1</span> Associations</a></li>
</ul></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 discoursemes</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">November 20, 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><span class="fu">library</span>(ggraph)</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidygraph)</span>
<span id="cb1-8"><a href="#cb1-8" 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="discoursemes" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Discoursemes</h1>
<ul>
<li>the canonical corpus linguistic approach to discourse analysis involves the grouping of observed surface types
<ul>
<li>usually from keyword or collocate tables on an <strong>analysis layer</strong> (typically word or lemma)</li>
<li>multi-word units (MWUs) are usually not featured in such tables, but reasonable units
<ul>
<li>e.g. NEs “Wladimir Putin”, “BUND Naturschutz”, or (especially English) noun compounds: “nuclear energy”, “conspiracy theory”</li>
</ul></li>
<li>in general, we use corpus queries to search for discourseme realisations (see below)
<ul>
<li>note that the analysis layer and the query are uncoupled</li>
<li>we can e.g. search for “measures” (the word), but use the lemma-layer for the analysis (= surface types)</li>
</ul></li>
</ul></li>
<li>groups of linguistic patterns (operationalised by queries) try to capture minimal units of lexical meaning in the context of a discourse
<ul>
<li>we call these “building blocks” of discourse analysis <strong>discoursemes</strong></li>
<li>some examples of discoursemes are given on the development server</li>
</ul></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>discoursemes <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/discourseme/"</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>discoursemes</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":["comment"],"name":[1],"type":["lgl"],"align":["right"]},{"label":["id"],"name":[2],"type":["int"],"align":["right"]},{"label":["name"],"name":[3],"type":["chr"],"align":["left"]},{"label":["template"],"name":[4],"type":["list"],"align":["right"]}],"data":[{"1":"NA","2":"1","3":"(fossile) Rohstoffe","4":"<df[,3] [5 × 3]>"},{"1":"NA","2":"2","3":"Anpassung","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"3","3":"Atomkraft","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"4","3":"Ausbau","4":"<df[,3] [2 × 3]>"},{"1":"NA","2":"5","3":"Ausstieg","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"6","3":"Erneuerbare Energien","4":"<df[,3] [2 × 3]>"},{"1":"NA","2":"7","3":"Kampf","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"8","3":"Klimawandel","4":"<df[,3] [2 × 3]>"},{"1":"NA","2":"9","3":"Mangel","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"10","3":"Ursachen","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"11","3":"Verursacher","4":"<df[,3] [4 × 3]>"},{"1":"NA","2":"12","3":"Wetter","4":"<df[,3] [1 × 3]>"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>we focus on the discourseme “Klimawandel”</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>discourseme <span class="ot"><-</span> discoursemes <span class="sc">|></span> <span class="fu">filter</span>(name <span class="sc">==</span> <span class="st">"Klimawandel"</span>)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>discourseme</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":["comment"],"name":[1],"type":["lgl"],"align":["right"]},{"label":["id"],"name":[2],"type":["int"],"align":["right"]},{"label":["name"],"name":[3],"type":["chr"],"align":["left"]},{"label":["template"],"name":[4],"type":["list"],"align":["right"]}],"data":[{"1":"NA","2":"8","3":"Klimawandel","4":"<df[,3] [2 × 3]>"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
<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>discourseme.id <span class="ot"><-</span> discourseme <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>
<ul>
<li>and use GERMAPARL-LP19 as an example corpus</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-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="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb6-5"><a href="#cb6-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="cb6-6"><a href="#cb6-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="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>()</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-9"><a href="#cb6-9" 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">"GERMAPARL-LP19"</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="descriptions-realisations" class="level2" data-number="2.1">
<h2 data-number="2.1" class="anchored" data-anchor-id="descriptions-realisations"><span class="header-section-number">2.1</span> Descriptions & Realisations</h2>
<ul>
<li><p>analysts have access to two major sources of information</p>
<ul>
<li>frequency tables (collocates, keywords) calculated on a positional attribute (<code>p="lemma"</code>)</li>
<li>concordance lines showing the primary (word) layer and the analysis layer (+ additional p-atts / s-atts))</li>
</ul></li>
<li><p>unigram items from frequency tables can be directly taken to describe some realisation of the discourseme</p>
<ul>
<li>the assumption here would be that all identical tokens / token sequences on the analysis layer belong to this discourseme</li>
<li>MWUs are usually found by generalising from concordance lines
<ul>
<li>default CQP query = surface realisation sequency on analysis layer</li>
</ul></li>
<li>in the backend, all descriptions are converted to CQP queries
<ul>
<li>MWUs are usually just (multi-token) CQP queries on a description layer</li>
</ul></li>
<li>we refer to the disjunction of queries in a corpus as a <strong>discourseme description</strong></li>
<li>on the other hand, all matches of the joint query are the <strong>discourseme realisation</strong></li>
</ul></li>
<li><p>the MMDA frontend is designed to allow the user to categorise types on the analysis layer</p>
<ul>
<li>especially based on frequency comparisons of unigram types</li>
</ul></li>
<li><p>note that this assumes all identical types on given <code>p</code> belong to the same discourseme</p>
<ul>
<li>this is obviously an assumption because any categorisation will have FPs and FNs
<ul>
<li>reading actual concordance lines establishes ultimate ground truth</li>
</ul></li>
<li>this is reasonable because
<ol type="1">
<li>the aim here is to form reproducible groupings on <code>p</code></li>
<li>a “lightweight” WSD (e.g. POS-based WSD) can be accomplished via choice of <code>p</code> (→ corpus annotation)</li>
<li>we allow disambiguation via constellations (see below)</li>
<li>for queries spanning several tokens, this is typically the case anyway (cf. spheroscope: exact same string, but different argument?)</li>
<li>we still allow to restrict discourseme description by means of actual CQP queries</li>
</ol></li>
</ul></li>
<li><p>alternative: allow to manually categorise initial matches + extend</p></li>
<li><p>describing a discourseme in a corpus means giving a list of items, each item being</p>
<ul>
<li>a surface realisation on an analysis layer (<code>'[p="surface"]'</code>)
<ul>
<li>token-level CQP wildcards can be used (<code>'[p="surfa.*"%cd]'</code>)</li>
</ul></li>
<li>MWUS, i.e. a sequence of surface realisations (<code>'[p="item.*"%cd] [p="another_item"]'</code>)</li>
<li>a full CQP query (which might include p-att and/or s-att restrictions) (<code>'[p1="item.*"%cd] & [p2="POS.*"] "someword" within "s"'</code>)</li>
<li>an anchored CQP query (with anchor corrections and slots)</li>
</ul></li>
<li><p>description of discourseme “Klimawandel”:</p></li>
</ul>
<div class="cell">
<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>description <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/discourseme/${discourseme.id}/description/"</span>) <span class="sc">|></span> </span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id, </span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="at">items =</span> <span class="fu">list</span>(</span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">list</span>(<span class="at">p =</span> <span class="st">"lemma"</span>, <span class="at">surface =</span> <span class="st">"Klimawandel"</span>),</span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">list</span>(<span class="at">p =</span> <span class="st">"lemma"</span>, <span class="at">surface =</span> <span class="st">"Klimaveränderung"</span>),</span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">list</span>(<span class="at">p =</span> <span class="st">"lemma"</span>, <span class="at">surface =</span> <span class="st">"global Erwärmung"</span>)</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a> ),</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a> <span class="at">s =</span> <span class="st">"s"</span>)</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">|></span></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb7-14"><a href="#cb7-14" 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="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a>description</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>$corpus_id
[1] 1
$discourseme_id
[1] 8
$id
[1] 1
$items
cqp_query p surface
1 NA lemma Klimawandel
2 NA lemma Klimaveränderung
3 NA lemma global Erwärmung
$match_strategy
[1] "longest"
$query_id
[1] 1
$s
[1] "s"
$subcorpus_id
NULL</code></pre>
</div>
</div>
<ul>
<li><p>note that a description has a canonical s-attribute (here: <code>s=s</code>, i.e. sentences) that are used to index query matches</p></li>
<li><p>reasonable corpus-dependent defaults are implemented in the backend</p></li>
<li><p>this is essential for a fast look-up of discourseme co-occurrences (see constellations below)</p></li>
<li><p>since each description corresponds to a query, we can use the usual endpoints for accessing concordance lines, breakdowns, collocation analyses, etc.</p></li>
</ul>
<div class="cell">
<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>description.query.id <span class="ot"><-</span> description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"query_id"</span>)</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${description.query.id}/breakdown"</span>)) <span class="sc">|></span> </span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb9-5"><a href="#cb9-5" 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="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb9-7"><a href="#cb9-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="cb9-8"><a href="#cb9-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="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>() <span class="sc">|></span> </span>
<span id="cb9-10"><a href="#cb9-10" 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":"Klimaveränderung","2":"2.3249972","3":"52","4":"22365618"},{"1":"Klimawandel","2":"61.0758889","3":"1366","4":"22365618"},{"1":"global Erwärmung","2":"0.7153838","3":"16","4":"22365618"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>the user can add items to a description</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>description.id <span class="ot"><-</span> description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>description <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/discourseme/${discourseme.id}/description/${description.id}/add-item"</span>) <span class="sc">|></span> </span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_method</span>(<span class="st">"patch"</span>) <span class="sc">|></span> </span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_body_json</span>(<span class="fu">list</span>(<span class="st">'p'</span> <span class="ot">=</span> <span class="st">'lemma'</span>, <span class="st">'surface'</span> <span class="ot">=</span> <span class="st">'Klimakrise'</span>)) <span class="sc">|></span> </span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb10-9"><a href="#cb10-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>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a>description</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>$corpus_id
[1] 1
$discourseme_id
[1] 8
$id
[1] 1
$items
cqp_query p surface
1 NA lemma Klimawandel
2 NA lemma Klimaveränderung
3 NA lemma global Erwärmung
4 NA lemma Klimakrise
$match_strategy
[1] "longest"
$query_id
[1] 2
$s
[1] "s"
$subcorpus_id
NULL</code></pre>
</div>
</div>
<ul>
<li>note that the query necessarily changes with every meaningful update (adding the same item twice does not affect the query)</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>description.query.id <span class="ot"><-</span> description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"query_id"</span>)</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${description.query.id}/breakdown"</span>)) <span class="sc">|></span> </span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb12-5"><a href="#cb12-5" 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="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 class="sc">|></span> </span>
<span id="cb12-8"><a href="#cb12-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="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>() <span class="sc">|></span> </span>
<span id="cb12-10"><a href="#cb12-10" 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":"Klimakrise","2":"22.3110312","3":"499","4":"22365618"},{"1":"Klimaveränderung","2":"2.3249972","3":"52","4":"22365618"},{"1":"Klimawandel","2":"61.0758889","3":"1366","4":"22365618"},{"1":"global Erwärmung","2":"0.7153838","3":"16","4":"22365618"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>removing items works similarly</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>description <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/discourseme/${discourseme.id}/description/${description.id}/remove-item"</span>) <span class="sc">|></span> </span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_method</span>(<span class="st">"patch"</span>) <span class="sc">|></span> </span>
<span id="cb13-5"><a href="#cb13-5" 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">surface =</span> <span class="st">'Klimakrise'</span>)) <span class="sc">|></span> </span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb13-7"><a href="#cb13-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>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a>description.query.id <span class="ot"><-</span> description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"query_id"</span>)</span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${description.query.id}/breakdown"</span>)) <span class="sc">|></span> </span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span></span>
<span id="cb13-13"><a href="#cb13-13" 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="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb13-15"><a href="#cb13-15" 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="cb13-16"><a href="#cb13-16" 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="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>() <span class="sc">|></span> </span>
<span id="cb13-18"><a href="#cb13-18" 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":"Klimaveränderung","2":"2.3249972","3":"52","4":"22365618"},{"1":"Klimawandel","2":"61.0758889","3":"1366","4":"22365618"},{"1":"global Erwärmung","2":"0.7153838","3":"16","4":"22365618"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>you will receive a <code>404</code> if you try to remove items that are not part of the description</li>
</ul>
</section>
<section id="discourseme-template" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="discourseme-template"><span class="header-section-number">2.2</span> Discourseme Template</h2>
<ul>
<li>discourseme descriptions without concrete corpora are possible via <strong>discourseme templates</strong></li>
<li>otherwise they follow the same logics as descriptions</li>
<li>template of discourseme “Klimawandel” from examples:</li>
</ul>
<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>discourseme <span class="sc">|></span> <span class="fu">pull</span>(template)</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]]
cqp_query p
1 NA lemma
2 NA lemma
surface
1 Klima(wandel|(ver)?änderung|wechsel|krise|katastrophe|notstand|lüge)
2 global Erwärmung</code></pre>
</div>
</div>
<ul>
<li>if you do not specify any items when creating a description, the template will be used instead</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>description <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/discourseme/${discourseme.id}/description/"</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_body_json</span>(<span class="fu">list</span>(<span class="at">corpus_id =</span> corpus.id)) <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>
<span id="cb16-7"><a href="#cb16-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb16-8"><a href="#cb16-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb16-9"><a href="#cb16-9" aria-hidden="true" tabindex="-1"></a>description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"items"</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":["cqp_query"],"name":[1],"type":["lgl"],"align":["right"]},{"label":["p"],"name":[2],"type":["chr"],"align":["left"]},{"label":["surface"],"name":[3],"type":["chr"],"align":["left"]}],"data":[{"1":"NA","2":"lemma","3":"Klima(wandel|(ver)?änderung|wechsel|krise|katastrophe|notstand|lüge)","_rn_":"1"},{"1":"NA","2":"lemma","3":"global Erwärmung","_rn_":"2"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<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>description.query.id <span class="ot"><-</span> description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"query_id"</span>)</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/query/${description.query.id}/breakdown"</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_url_query</span>(<span class="at">p =</span> <span class="st">"lemma"</span>) <span class="sc">|></span> </span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb17-7"><a href="#cb17-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="cb17-8"><a href="#cb17-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="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">tibble</span>() <span class="sc">|></span> </span>
<span id="cb17-10"><a href="#cb17-10" 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":"Klimakatastrophe","2":"3.39807288","3":"76","4":"22365618"},{"1":"Klimakrise","2":"22.31103116","3":"499","4":"22365618"},{"1":"Klimalüge","2":"0.04471149","3":"1","4":"22365618"},{"1":"Klimanotstand","2":"1.74374793","3":"39","4":"22365618"},{"1":"Klimaveränderung","2":"2.32499723","3":"52","4":"22365618"},{"1":"Klimawandel","2":"61.07588889","3":"1366","4":"22365618"},{"1":"Klimawechsel","2":"0.08942297","3":"2","4":"22365618"},{"1":"Klimaänderung","2":"0.26826891","3":"6","4":"22365618"},{"1":"global Erwärmung","2":"0.71538376","3":"16","4":"22365618"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li>you can create and modify templates via <code>PATCH /mmda/discourseme/<id>/</code></li>
<li><code>POST /mmda/discourseme/<id>/</code> will generate a template from existing descriptions (TODO not implemented as of 2024-11-04)</li>
</ul>
</section>
</section>
<section id="discourseme-constellations" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> Discourseme Constellations</h1>
<ul>
<li>several discoursemes can be combined to form a <strong>discourseme constellation</strong></li>
<li>constellations are used to highlight a set of discoursemes in analyses (concordancing, collocation tables, etc.)</li>
<li>we create a constellation with discoursemes related to climate change</li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>discoursemes</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":["comment"],"name":[1],"type":["lgl"],"align":["right"]},{"label":["id"],"name":[2],"type":["int"],"align":["right"]},{"label":["name"],"name":[3],"type":["chr"],"align":["left"]},{"label":["template"],"name":[4],"type":["list"],"align":["right"]}],"data":[{"1":"NA","2":"1","3":"(fossile) Rohstoffe","4":"<df[,3] [5 × 3]>"},{"1":"NA","2":"2","3":"Anpassung","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"3","3":"Atomkraft","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"4","3":"Ausbau","4":"<df[,3] [2 × 3]>"},{"1":"NA","2":"5","3":"Ausstieg","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"6","3":"Erneuerbare Energien","4":"<df[,3] [2 × 3]>"},{"1":"NA","2":"7","3":"Kampf","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"8","3":"Klimawandel","4":"<df[,3] [2 × 3]>"},{"1":"NA","2":"9","3":"Mangel","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"10","3":"Ursachen","4":"<df[,3] [1 × 3]>"},{"1":"NA","2":"11","3":"Verursacher","4":"<df[,3] [4 × 3]>"},{"1":"NA","2":"12","3":"Wetter","4":"<df[,3] [1 × 3]>"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<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>constellation <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/constellation/"</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_body_json</span>(<span class="fu">list</span>(<span class="at">discourseme_ids =</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">12</span>)) <span class="sc">|></span> </span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb19-6"><a href="#cb19-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="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a>constellation</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>$comment
NULL
$discoursemes
comment id name
1 NA 1 (fossile) Rohstoffe
2 NA 2 Anpassung
3 NA 3 Atomkraft
4 NA 4 Ausbau
5 NA 5 Ausstieg
6 NA 6 Erneuerbare Energien
7 NA 7 Kampf
8 NA 8 Klimawandel
9 NA 9 Mangel
10 NA 10 Ursachen
11 NA 11 Verursacher
12 NA 12 Wetter
template
1 NA, NA, NA, NA, NA, lemma, lemma, lemma, lemma, lemma, fossil Energie|Brennstoff, (Braun|Stein)?[Kk]ohle, Erd(gas|öl), Mineralöl, Gas|Öl
2 NA, lemma, [Bb]ewältig(en|ung)|(Anpassungs?)?([Mm]aßnahme)?
3 NA, lemma, (Kern|Atom|Nuklear)(kraft|energie)(werk)?
4 NA, NA, lemma, lemma, Ausbau|ausbauen|Förderung, Steigerung die Anteil
5 NA, lemma, Ausstieg|aussteigen
6 NA, NA, lemma, lemma, erneuerbar|regenerativ Energie, (Wind|Sonnen)energie
7 NA, lemma, Kampf|Bekämpfung|aufhalten
8 NA, NA, lemma, lemma, Klima(wandel|(ver)?änderung|wechsel|krise|katastrophe|notstand|lüge), global Erwärmung
9 NA, lemma, Armut|Hunger|Dürre|Ressourcenknappheit
10 NA, lemma, Treibhausgas(emission)?
11 NA, NA, NA, NA, lemma, lemma, lemma, lemma, menschengemacht, Mitverursacher, Hauptverursacher, Verursacher
12 NA, lemma, Sturm|(Extrem)?[Ww]etter(ereignis)|Naturkatastrophe|Wetterextrem
$id
[1] 2
$name
[1] "(fossile)-Rohstoffe-Anpassung-Atomkraft-Ausbau-Ausstieg-Erneuerbare-Energien-Kampf-Klimawandel-Mangel-Ursachen-Verursacher-Wetter"</code></pre>
</div>
</div>
<section id="constellation-descriptions" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="constellation-descriptions"><span class="header-section-number">3.1</span> Constellation Descriptions</h2>
<ul>
<li>as with discoursemes, the user wants to <strong>describe</strong> constellations in corpora</li>
<li>constellation descriptions consist of all the individual discourseme descriptions with a joint s-attribute for query indexing</li>
<li>when creating a constellation description, the backend makes sure that all discoursemes belonging to this constellation have an adequate description (using existing descriptions or creating descriptions from templates)</li>
</ul>
<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>constellation.id <span class="ot"><-</span> constellation <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a>constellation.description <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/constellation/${constellation.id}/description/"</span>) <span class="sc">|></span> </span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb21-5"><a href="#cb21-5" 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="sc">|></span> </span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb21-8"><a href="#cb21-8" 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="cb21-9"><a href="#cb21-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb21-10"><a href="#cb21-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-11"><a href="#cb21-11" aria-hidden="true" tabindex="-1"></a>constellation.description</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>$corpus_id
[1] 1
$discourseme_descriptions
corpus_id discourseme_id id
1 1 1 3
2 1 2 4
3 1 3 5
4 1 4 6
5 1 5 7
6 1 6 8
7 1 7 9
8 1 8 1
9 1 9 10
10 1 10 11
11 1 11 12
12 1 12 13
items
1 NA, NA, NA, NA, NA, lemma, lemma, lemma, lemma, lemma, fossil Energie|Brennstoff, (Braun|Stein)?[Kk]ohle, Erd(gas|öl), Mineralöl, Gas|Öl
2 NA, lemma, [Bb]ewältig(en|ung)|(Anpassungs?)?([Mm]aßnahme)?
3 NA, lemma, (Kern|Atom|Nuklear)(kraft|energie)(werk)?
4 NA, NA, lemma, lemma, Ausbau|ausbauen|Förderung, Steigerung die Anteil
5 NA, lemma, Ausstieg|aussteigen
6 NA, NA, lemma, lemma, erneuerbar|regenerativ Energie, (Wind|Sonnen)energie
7 NA, lemma, Kampf|Bekämpfung|aufhalten
8 NA, NA, NA, lemma, lemma, lemma, Klimawandel, Klimaveränderung, global Erwärmung
9 NA, lemma, Armut|Hunger|Dürre|Ressourcenknappheit
10 NA, lemma, Treibhausgas(emission)?
11 NA, NA, NA, NA, lemma, lemma, lemma, lemma, menschengemacht, Mitverursacher, Hauptverursacher, Verursacher
12 NA, lemma, Sturm|(Extrem)?[Ww]etter(ereignis)|Naturkatastrophe|Wetterextrem
match_strategy query_id s subcorpus_id
1 longest 5 s NA
2 longest 6 s NA
3 longest 7 s NA
4 longest 8 s NA
5 longest 9 s NA
6 longest 10 s NA
7 longest 11 s NA
8 longest 3 s NA
9 longest 12 s NA
10 longest 13 s NA
11 longest 14 s NA
12 longest 15 s NA
$id
[1] 1
$match_strategy
[1] "longest"
$s
[1] "s"
$semantic_map_id
NULL
$subcorpus_id
NULL</code></pre>
</div>
</div>
<ul>
<li>constellation descriptions are the appropriate starting point when working with corpus data (concordancing, analyses)</li>
</ul>
</section>
<section id="concordancing" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="concordancing"><span class="header-section-number">3.2</span> Concordancing</h2>
<ul>
<li>when accessing concordances and analyses via the constellation endpoint, you get information about all discoursemes of the constellation</li>
<li>choose a <code>focus_discourseme_id</code> to extract concordance lines of a constellation (the discourseme used for initial filtering and centering in KWIC)</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>constellation.description.id <span class="ot"><-</span> constellation.description <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"id"</span>)</span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a>concordance <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/constellation/${constellation.id}/description/${constellation.description.id}/concordance"</span>) <span class="sc">|></span> </span>
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">request</span>() <span class="sc">|></span> </span>
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">focus_discourseme_id =</span> discourseme.id) <span class="sc">|></span> </span>
<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <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">"body"</span>) <span class="sc">|></span></span>
<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a> <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>
<ul>
<li>concordances include <code>discourseme_ranges</code> that can be used for highlighting</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>concordance <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>) <span class="sc">|></span> </span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">slice</span>(<span class="dv">5</span>) <span class="sc">|></span> </span>
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(discourseme_ranges)</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]]
discourseme_id end start
1 7 9716150 9716150
2 8 9716152 9716152</code></pre>
</div>
<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>concordance <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>) <span class="sc">|></span> </span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">slice</span>(<span class="dv">5</span>) <span class="sc">|></span> </span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(tokens)</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
1 9716127 FALSE -25 TRUE es
2 9716128 FALSE -24 TRUE in
3 9716129 FALSE -23 TRUE Zukunft
4 9716130 FALSE -22 TRUE aber
5 9716131 FALSE -21 TRUE schwerer
6 9716132 FALSE -20 TRUE ,
7 9716133 FALSE -19 TRUE den
8 9716134 FALSE -18 TRUE Erfolg
9 9716135 FALSE -17 TRUE der
10 9716136 FALSE -16 TRUE Entwicklungshilfeausgaben
11 9716137 FALSE -15 TRUE zu
12 9716138 FALSE -14 TRUE bewerten
13 9716139 FALSE -13 TRUE ;
14 9716140 FALSE -12 TRUE denn
15 9716141 FALSE -11 TRUE nun
16 9716142 FALSE -10 FALSE will
17 9716143 FALSE -9 FALSE auch
18 9716144 FALSE -8 FALSE das
19 9716145 FALSE -7 FALSE BMZ
20 9716146 FALSE -6 FALSE verstärkt
21 9716147 FALSE -5 FALSE in
22 9716148 FALSE -4 FALSE die
23 9716149 FALSE -3 FALSE weltweite
24 9716150 FALSE -2 FALSE Bekämpfung
25 9716151 FALSE -1 FALSE des
26 9716152 FALSE 0 FALSE Klimawandels
27 9716153 FALSE 1 FALSE einsteigen
28 9716154 FALSE 2 FALSE .
29 9716155 FALSE 3 TRUE Herr
30 9716156 FALSE 4 TRUE Minister
31 9716157 FALSE 5 TRUE ,
32 9716158 FALSE 6 TRUE Sie
33 9716159 FALSE 7 TRUE sagten
34 9716160 FALSE 8 TRUE vor
35 9716161 FALSE 9 TRUE wenigen
36 9716162 FALSE 10 TRUE Wochen
37 9716163 FALSE 11 TRUE in
38 9716164 FALSE 12 TRUE der
39 9716165 FALSE 13 TRUE Presse
40 9716166 FALSE 14 TRUE ,
41 9716167 FALSE 15 TRUE dass
42 9716168 FALSE 16 TRUE nationale
43 9716169 FALSE 17 TRUE Maßnahmen
44 9716170 FALSE 18 TRUE zur
45 9716171 FALSE 19 TRUE Klimarettung
46 9716172 FALSE 20 TRUE nur
47 9716173 FALSE 21 TRUE ein
48 9716174 FALSE 22 TRUE Tropfen
49 9716175 FALSE 23 TRUE auf
50 9716176 FALSE 24 TRUE den
51 9716177 FALSE 25 TRUE heißen
secondary
1 sie
2 in
3 Zukunft
4 aber
5 schwer
6 ,
7 die
8 Erfolg
9 die
10 Entwicklungshilfeausgabe
11 zu
12 bewerten
13 ;
14 denn
15 nun
16 wollen
17 auch
18 die
19 BMZ
20 verstärkt
21 in
22 die
23 weltweit
24 Bekämpfung
25 die
26 Klimawandel
27 einsteigen
28 .
29 Herr
30 Minister
31 ,
32 sie
33 sagen
34 vor
35 wenige
36 Woche
37 in
38 die
39 Presse
40 ,
41 dass
42 national
43 Maßnahme
44 zu
45 Klimarettung
46 nur
47 eine
48 Tropfen
49 auf
50 die
51 heiß</code></pre>
</div>
</div>
<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><span class="fu">source</span>(<span class="st">"../R-utils/concordance.R"</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-stderr">
<pre><code>
Attaching package: 'magrittr'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:purrr':
set_names</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:tidyr':
extract</code></pre>
</div>
<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>disc.colours <span class="ot"><-</span> <span class="fu">tibble</span>(</span>
<span id="cb32-2"><a href="#cb32-2" aria-hidden="true" tabindex="-1"></a> <span class="at">discourseme_id =</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">20</span>,</span>
<span id="cb32-3"><a href="#cb32-3" aria-hidden="true" tabindex="-1"></a> <span class="at">colour =</span> viridis<span class="sc">::</span><span class="fu">viridis</span>(<span class="dv">20</span>)</span>
<span id="cb32-4"><a href="#cb32-4" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb32-5"><a href="#cb32-5" aria-hidden="true" tabindex="-1"></a>concordance <span class="sc">|></span> <span class="fu">latex.line</span>(disc.colours)</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] "bekämpfen will , der muss den Klimawandel bekämpfen . Und wer verhindern will , dass es in Zukunft Kriege gibt , die etwas mit dem \\colorbox{#2D718EFF}{Klimawandel} zu tun haben , der muss heute den \\colorbox{#2D718EFF}{Klimawandel} bekämpfen . Daher setzen wir uns im Sicherheitsrat auch dafür ein , dass dort mehr präventiv "</code></pre>
</div>
</div>
<ul>
<li>default concordancing for collocation analyses via KWIC view</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>concordance <span class="sc">|></span> <span class="fu">conc.kwic</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":["left"],"name":[1],"type":["chr"],"align":["left"]},{"label":["node"],"name":[2],"type":["chr"],"align":["left"]},{"label":["right"],"name":[3],"type":["chr"],"align":["left"]},{"label":["date"],"name":[4],"type":["chr"],"align":["left"]},{"label":["filetype"],"name":[5],"type":["chr"],"align":["left"]},{"label":["lp"],"name":[6],"type":["chr"],"align":["left"]},{"label":["ner"],"name":[7],"type":["int"],"align":["right"]},{"label":["ner_type"],"name":[8],"type":["int"],"align":["right"]},{"label":["parliamentary_group"],"name":[9],"type":["chr"],"align":["left"]},{"label":["party"],"name":[10],"type":["chr"],"align":["left"]},{"label":["plenary_protocol"],"name":[11],"type":["chr"],"align":["left"]},{"label":["protocol_no"],"name":[12],"type":["chr"],"align":["left"]},{"label":["role"],"name":[13],"type":["chr"],"align":["left"]},{"label":["speaker"],"name":[14],"type":["chr"],"align":["left"]},{"label":["speaker_node"],"name":[15],"type":["chr"],"align":["left"]},{"label":["stage"],"name":[16],"type":["int"],"align":["right"]},{"label":["stage_type"],"name":[17],"type":["int"],"align":["right"]},{"label":["url"],"name":[18],"type":["chr"],"align":["left"]},{"label":["who"],"name":[19],"type":["chr"],"align":["left"]},{"label":["year"],"name":[20],"type":["chr"],"align":["left"]}],"data":[{"1":"es in Zukunft Kriege gibt , die etwas mit dem","2":"Klimawandel","3":"zu tun haben , der muss heute den Klimawandel bekämpfen","4":"2019-09-11","5":"xml","6":"19","7":"-1","8":"-1","9":"__NA__","10":"SPD","11":"lp=\"19\" protocol_no=\"111\" date=\"2019-09-11\" url=\"https://www.bundestag.de/resource/blob/657298/3e868aff28392e81e24456cbf8b89501/19111-data.xml\" filetype=\"xml\" year=\"2019\"","12":"111","13":"government","14":"Heiko Maas","15":"who=\"Heiko Maas\" name=\"Heiko Maas\" parliamentary_group=\"NA\" party=\"SPD\" role=\"government\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/657298/3e868aff28392e81e24456cbf8b89501/19111-data.xml","19":"Heiko Maas","20":"2019"},{"1":"– Sie ignorieren den menschengemachten","2":"Klimawandel","3":".","4":"2021-05-21","5":"xml","6":"19","7":"-1","8":"-1","9":"SPD","10":"SPD","11":"lp=\"19\" protocol_no=\"231\" date=\"2021-05-21\" url=\"https://www.bundestag.de/resource/blob/843808/70345a836d91b763742416e0469cd62b/19231-data.xml\" filetype=\"xml\" year=\"2021\"","12":"231","13":"mp","14":"Klaus Mindrup","15":"who=\"Klaus Mindrup\" name=\"Klaus Mindrup\" parliamentary_group=\"SPD\" party=\"SPD\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/843808/70345a836d91b763742416e0469cd62b/19231-data.xml","19":"Klaus Mindrup","20":"2021"},{"1":": Im Bundeshaushalt geschieht jetzt schon einiges , um den","2":"Klimawandel","3":"zu stoppen bzw. wenigstens zu verlangsamen .","4":"2018-11-20","5":"xml","6":"19","7":"-1","8":"-1","9":"CDU/CSU","10":"CDU","11":"lp=\"19\" protocol_no=\"63\" date=\"2018-11-20\" url=\"https://www.bundestag.de/resource/blob/579752/52470466623d8cd77b3a895e807eff51/19063-data.xml\" filetype=\"xml\" year=\"2018\"","12":"63","13":"mp","14":"Ingo Gädechens","15":"who=\"Ingo Gädechens\" name=\"Ingo Gädechens\" parliamentary_group=\"CDU/CSU\" party=\"CDU\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/579752/52470466623d8cd77b3a895e807eff51/19063-data.xml","19":"Ingo Gädechens","20":"2018"},{"1":"mich fragt : Warum habt ihr nichts gegen den menschengemachten","2":"Klimawandel","3":"getan ?","4":"2018-03-23","5":"xml","6":"19","7":"-1","8":"-1","9":"FDP","10":"FDP","11":"lp=\"19\" protocol_no=\"24\" date=\"2018-03-23\" url=\"https://www.bundestag.de/resource/blob/548910/1c3ab3b3333a175edc7b49f99b7ec19c/19024-data.xml\" filetype=\"xml\" year=\"2018\"","12":"24","13":"mp","14":"Lukas Köhler","15":"who=\"Lukas Köhler\" name=\"Lukas Köhler\" parliamentary_group=\"FDP\" party=\"FDP\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/548910/1c3ab3b3333a175edc7b49f99b7ec19c/19024-data.xml","19":"Lukas Köhler","20":"2018"},{"1":"will auch das BMZ verstärkt in die weltweite Bekämpfung des","2":"Klimawandels","3":"einsteigen .","4":"2019-09-11","5":"xml","6":"19","7":"-1","8":"-1","9":"AfD","10":"AfD","11":"lp=\"19\" protocol_no=\"111\" date=\"2019-09-11\" url=\"https://www.bundestag.de/resource/blob/657298/3e868aff28392e81e24456cbf8b89501/19111-data.xml\" filetype=\"xml\" year=\"2019\"","12":"111","13":"mp","14":"Volker Münz","15":"who=\"Volker Münz\" name=\"Volker Münz\" parliamentary_group=\"AfD\" party=\"AfD\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/657298/3e868aff28392e81e24456cbf8b89501/19111-data.xml","19":"Volker Münz","20":"2019"},{"1":"und : „ Die Behauptung , der","2":"Klimawandel","3":"ist schuld , ist … nicht haltbar .","4":"2021-08-25","5":"xml","6":"19","7":"-1","8":"-1","9":"AfD","10":"AfD","11":"lp=\"19\" protocol_no=\"238\" date=\"2021-08-25\" url=\"https://www.bundestag.de/resource/blob/855838/28c3311ac01c1d047e818dd62331112e/19238-data.xml\" filetype=\"xml\" year=\"2021\"","12":"238","13":"mp","14":"Peter Boehringer","15":"who=\"Peter Boehringer\" name=\"Peter Boehringer\" parliamentary_group=\"AfD\" party=\"AfD\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/855838/28c3311ac01c1d047e818dd62331112e/19238-data.xml","19":"Peter Boehringer","20":"2021"},{"1":"RWE klagt , weil sein Bergdorf in den Anden vom","2":"Klimawandel","3":"bedroht ist .","4":"2018-10-10","5":"xml","6":"19","7":"-1","8":"-1","9":"DIE LINKE","10":"DIE LINKE","11":"lp=\"19\" protocol_no=\"54\" date=\"2018-10-10\" url=\"https://www.bundestag.de/resource/blob/572934/1e36d1dfea802b345a63b8dc19f21485/19054-data.xml\" filetype=\"xml\" year=\"2018\"","12":"54","13":"mp","14":"Lorenz Gösta Beutin","15":"who=\"Lorenz Gösta Beutin\" name=\"Lorenz Gösta Beutin\" parliamentary_group=\"DIE LINKE\" party=\"DIE LINKE\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/572934/1e36d1dfea802b345a63b8dc19f21485/19054-data.xml","19":"Lorenz Gösta Beutin","20":"2018"},{"1":"die Landwirtschaft einen Beitrag leisten muss im Kampf gegen den","2":"Klimawandel","3":".","4":"2021-01-27","5":"xml","6":"19","7":"-1","8":"-1","9":"FDP","10":"FDP","11":"lp=\"19\" protocol_no=\"205\" date=\"2021-01-27\" url=\"https://www.bundestag.de/resource/blob/819494/7e940d1e7c88fd8753c987d13f5ce6ca/19205-data.xml\" filetype=\"xml\" year=\"2021\"","12":"205","13":"mp","14":"Gero Clemens Hocker","15":"who=\"Gero Clemens Hocker\" name=\"Gero Clemens Hocker\" parliamentary_group=\"FDP\" party=\"FDP\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/819494/7e940d1e7c88fd8753c987d13f5ce6ca/19205-data.xml","19":"Gero Clemens Hocker","20":"2021"},{"1":"auch nicht wie Sie hier ein pseudowissenschaftliches Seminar zum Thema","2":"Klimawandel","3":"halten .","4":"2018-07-03","5":"xml","6":"19","7":"-1","8":"-1","9":"CDU/CSU","10":"fraktionslos","11":"lp=\"19\" protocol_no=\"44\" date=\"2018-07-03\" url=\"https://www.bundestag.de/resource/blob/562990/056c28051cb695642cb9d72521bba93b/19044-data.xml\" filetype=\"xml\" year=\"2018\"","12":"44","13":"mp","14":"Georg Nüßlein","15":"who=\"Georg Nüßlein\" name=\"Georg Nüßlein\" parliamentary_group=\"CDU/CSU\" party=\"fraktionslos\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/562990/056c28051cb695642cb9d72521bba93b/19044-data.xml","19":"Georg Nüßlein","20":"2018"},{"1":"Der","2":"Klimawandel","3":"– wir haben das vorhin auch schon angesprochen – ist","4":"2020-09-30","5":"xml","6":"19","7":"-1","8":"-1","9":"DIE LINKE","10":"DIE LINKE","11":"lp=\"19\" protocol_no=\"179\" date=\"2020-09-30\" url=\"https://www.bundestag.de/resource/blob/795706/b678f2795499c7dbc778b49f63131950/19179-data.xml\" filetype=\"xml\" year=\"2020\"","12":"179","13":"mp","14":"Michael Leutert","15":"who=\"Michael Leutert\" name=\"Michael Leutert\" parliamentary_group=\"DIE LINKE\" party=\"DIE LINKE\" role=\"mp\"","16":"-1","17":"-1","18":"https://www.bundestag.de/resource/blob/795706/b678f2795499c7dbc778b49f63131950/19179-data.xml","19":"Michael Leutert","20":"2020"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
</div>
<ul>
<li><p>with appropriate highlighting of discoursemes and context</p></li>
<li><p>for filtering, you can give (additional) discourseme ids</p></li>
</ul>
<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>concordance <span class="ot"><-</span> <span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/constellation/${constellation.id}/description/${constellation.description.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">request</span>() <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">focus_discourseme_id =</span> discourseme.id,</span>
<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a> <span class="at">filter_discourseme_ids =</span> <span class="fu">c</span>(<span class="dv">1</span>)) <span class="sc">|></span> </span>
<span id="cb35-5"><a href="#cb35-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb35-6"><a href="#cb35-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</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">"body"</span>) <span class="sc">|></span></span>
<span id="cb35-8"><a href="#cb35-8" aria-hidden="true" tabindex="-1"></a> <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>
<div class="cell">
<div class="sourceCode cell-code" id="cb36"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a>concordance <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>) <span class="sc">|></span> </span>
<span id="cb36-2"><a href="#cb36-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">slice</span>(<span class="dv">1</span>) <span class="sc">|></span> </span>
<span id="cb36-3"><a href="#cb36-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(discourseme_ranges)</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]]
discourseme_id end start
1 1 22327614 22327614
2 3 22327619 22327619
3 5 22327620 22327620
4 8 22327608 22327608</code></pre>
</div>
<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>concordance <span class="sc">|></span> magrittr<span class="sc">::</span><span class="fu">extract2</span>(<span class="st">"lines"</span>) <span class="sc">|></span> </span>
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">slice</span>(<span class="dv">1</span>) <span class="sc">|></span> </span>
<span id="cb38-3"><a href="#cb38-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(tokens)</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 22327583 FALSE -25 TRUE Grünen Grünen
2 22327584 FALSE -24 TRUE in in
3 22327585 FALSE -23 TRUE dieser diese
4 22327586 FALSE -22 TRUE Zeit Zeit
5 22327587 FALSE -21 TRUE , ,
6 22327588 FALSE -20 TRUE fast fast
7 22327589 FALSE -19 TRUE 20 20
8 22327590 FALSE -18 TRUE Jahre Jahr
9 22327591 FALSE -17 TRUE , ,
10 22327592 FALSE -16 TRUE richtete richten
11 22327593 FALSE -15 TRUE sich sie
12 22327594 FALSE -14 TRUE gegen gegen
13 22327595 FALSE -13 TRUE die die
14 22327596 FALSE -12 TRUE Kernkraft Kernkraft
15 22327597 FALSE -11 TRUE . .
16 22327598 FALSE -10 TRUE Das die
17 22327599 FALSE -9 TRUE war sein
18 22327600 FALSE -8 TRUE die die
19 22327601 FALSE -7 TRUE falsche falsch
20 22327602 FALSE -6 TRUE Reihenfolge Reihenfolge
21 22327603 FALSE -5 TRUE . .
22 22327604 FALSE -4 FALSE Mit mit
23 22327605 FALSE -3 FALSE Blick Blick
24 22327606 FALSE -2 FALSE auf auf
25 22327607 FALSE -1 FALSE den die
26 22327608 FALSE 0 FALSE Klimawandel Klimawandel
27 22327609 FALSE 1 FALSE hätten haben
28 22327610 FALSE 2 FALSE wir sie
29 22327611 FALSE 3 FALSE erst erst
30 22327612 FALSE 4 FALSE aus aus
31 22327613 FALSE 5 FALSE der die
32 22327614 FALSE 6 FALSE Kohle Kohle
33 22327615 FALSE 7 FALSE und und
34 22327616 FALSE 8 FALSE dann dann
35 22327617 FALSE 9 FALSE aus aus
36 22327618 FALSE 10 FALSE der die
37 22327619 FALSE 11 TRUE Kernenergie Kernenergie
38 22327620 FALSE 12 TRUE aussteigen aussteigen
39 22327621 FALSE 13 TRUE müssen müssen
40 22327622 FALSE 14 TRUE . .
41 22327623 FALSE 15 TRUE Das die
42 22327624 FALSE 16 TRUE ist sein
43 22327625 FALSE 17 TRUE etwas etwas
44 22327626 FALSE 18 TRUE , ,
45 22327627 FALSE 19 TRUE dem die
46 22327628 FALSE 20 TRUE man man
47 22327629 FALSE 21 TRUE sich sie
48 22327630 FALSE 22 TRUE stellen stellen
49 22327631 FALSE 23 TRUE muss müssen
50 22327632 FALSE 24 TRUE . .
51 22327633 FALSE 25 TRUE ( (</code></pre>
</div>
</div>
<ul>
<li>filtering works on a variable <code>window=10</code> (and the description s-att)</li>
</ul>
</section>
<section id="collocation-analysis" class="level2" data-number="3.3">
<h2 data-number="3.3" class="anchored" data-anchor-id="collocation-analysis"><span class="header-section-number">3.3</span> Collocation Analysis</h2>
<ul>
<li>focusing on a discourseme in an analysis, you can create a collocation analysis</li>
</ul>
<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>collocation <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/constellation/${constellation.id}/description/${constellation.description.id}/collocation/"</span>)) <span class="sc">|></span> </span>
<span id="cb40-2"><a href="#cb40-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">window =</span> <span class="dv">10</span>, <span class="at">focus_discourseme_id =</span> discourseme.id)) <span class="sc">|></span> </span>
<span id="cb40-3"><a href="#cb40-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb40-4"><a href="#cb40-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</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">"body"</span>) <span class="sc">|></span> <span class="fu">rawToChar</span>() <span class="sc">|></span> <span class="fu">fromJSON</span>()</span>
<span id="cb40-6"><a href="#cb40-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb40-7"><a href="#cb40-7" aria-hidden="true" tabindex="-1"></a>collocation.id <span class="ot"><-</span> collocation <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>this takes longer than usual because scores for each discourseme will be calculated</li>
</ul>
<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>collocation.items <span class="ot"><-</span> <span class="fu">request</span>(<span class="fu">str_interp</span>(<span class="st">"${url_api}/mmda/constellation/${constellation.id}/description/${constellation.description.id}/collocation/${collocation.id}/items"</span>)) <span class="sc">|></span> </span>
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_auth_bearer_token</span>(access.token) <span class="sc">|></span> </span>
<span id="cb41-3"><a href="#cb41-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_url_query</span>(<span class="at">page_size =</span> <span class="dv">50</span>) <span class="sc">|></span> </span>
<span id="cb41-4"><a href="#cb41-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">req_perform</span>() <span class="sc">|></span> </span>
<span id="cb41-5"><a href="#cb41-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>
<ul>
<li>you get collocation items just like in a traditional collocation analysis</li>
<li>we remove the (unigram) breakdown of the focus discourseme from the collocation profile; TODO: is this really necessary?</li>
<li>this is not straightforward because we assume that discoursemes can overlap (the same item can be categorised as belonging to several discourseme)
<ul>
<li>so it does not actually make sense to filter out the collocation node</li>
<li>but: focus discoursemes with many surface realisation types otherwise hide everything else</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>item.scores <span class="ot"><-</span> collocation.items <span class="sc">|></span> </span>
<span id="cb42-2"><a href="#cb42-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="cb42-3"><a href="#cb42-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="cb42-4"><a href="#cb42-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="cb42-5"><a href="#cb42-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>