demo: collocation analysis slide with rounded, linked collocate table; cite CMC 2026 wiki talk pages paper
Change-Id: I461b285c25ad6b31c361de60b125198509379041
diff --git a/examples/ids.Rmd b/examples/ids.Rmd
index 9fca102..3042052 100644
--- a/examples/ids.Rmd
+++ b/examples/ids.Rmd
@@ -29,7 +29,8 @@
library(RKorAPClient)
library(highcharter)
library(tidyverse)
-source("https://gitlab.ids-mannheim.de/ICC/2023-07-20-ICC-ICLC10/-/raw/master/R/common.R")
+library(DT)
+#source("https://gitlab.ids-mannheim.de/ICC/2023-07-20-ICC-ICLC10/-/raw/master/R/common.R")
```
# Introduction
@@ -89,36 +90,80 @@
```
-## Source Code
-### Collocation Analysis
+## Adjective Collocates
+### of *Sockenpuppe* in the German Wikipedia Talk Corpus [@kupietz_wikipedia_talk_2026]
-```R
- df <- collocationAnalysis(
- icc_con("eng"),
- "focus({[ud/l=take]} [ud/p=NOUN])",
- leftContextSize = 0,
- rightContextSize = 1,
- minOccur = 2,
- addExamples = T
- )
+```{r ca, message=F, warning=F, escape=F}
+library(RKorAPClient)
+KorAPConnection("https://korap.ids-mannheim.de/instance/wiki", verbose=F) |>
+ collocationAnalysis(
+ "focus([spacy/u=ADJ] {[spacy/l=Sockenpuppe]})",
+ leftContextSize = 1,
+ rightContextSize = 0,
+ cacheAs = "sockenpuppe_aca.rds"
+) |>
+mutate(collocate = sprintf("[%s](%s)", collocate, webUIRequestUrl),
+ across(where(is.numeric), ~ round(.x, 2))) |>
+select(collocate, logDice, pmi, ll) |>
+head(8)
```
-See [@kupietz_rkorapclient_2020]
-See [@kupietz-deliko2026]
-## Source Code
-### Print Collocation Analysis as DataTable
+
+## Complete Source Code
+### of the previous slide's collocation analysis
```R
-df %>%
- mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%
- mutate(example=str_replace(example,
- ".*(\\W+\\w+\\W+\\w+\\W+<mark.*/mark>.*)", "\\1")) %>%
- mutate(example=str_replace(example,
- "(.*<mark.*/mark>\\W+\\w+\\W+\\w+).*", "\\1")) %>%
- rowwise() %>%
- select(Collocate, Example, logDice, pmi, ll) %>%
- datatable(escape = F) %>%
- formatRound(columns=~logDice + pmi + ll, digits=2)
+library(RKorAPClient)
+KorAPConnection("https://korap.ids-mannheim.de/instance/wiki", verbose=F) |>
+ collocationAnalysis(
+ "focus([spacy/u=ADJ] {[spacy/l=Sockenpuppe]})",
+ leftContextSize = 1,
+ rightContextSize = 0,
+ cacheAs = "sockenpuppe_aca.rds"
+) |>
+mutate(collocate = sprintf("[%s](%s)", collocate, webUIRequestUrl),
+ across(where(is.numeric), ~ round(.x, 2))) |>
+select(collocate, logDice, pmi, ll) |>
+head(8)
+```
+<small>Using RKorAPClient [@kupietz_rkorapclient_2020;@kupietz_building_2022]</small>
+
+## Adjective Collocates
+### of *Sockenpuppe* using DataTable for displaying
+
+```{r cadt, message=F, warning=F, escape=F}
+library(RKorAPClient)
+KorAPConnection("https://korap.ids-mannheim.de/instance/wiki", verbose=F) |>
+ collocationAnalysis(
+ "focus([spacy/u=ADJ] {[spacy/l=Sockenpuppe]})",
+ leftContextSize = 1,
+ rightContextSize = 0,
+ cacheAs = "sockenpuppe_aca.rds"
+) |>
+head(8) |>
+mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) |>
+select(Collocate, logDice, pmi, ll) |>
+datatable(escape=F) |>
+formatRound(columns=~logDice + pmi + ll, digits=2)
+```
+
+## Source Code
+### Display Collocation Analysis Result as DataTable
+
+```R
+library(RKorAPClient)
+KorAPConnection("https://korap.ids-mannheim.de/instance/wiki", verbose=F) |>
+ collocationAnalysis(
+ "focus([spacy/u=ADJ] {[spacy/l=Sockenpuppe]})",
+ leftContextSize = 1,
+ rightContextSize = 0,
+ cacheAs = "sockenpuppe_aca.rds"
+) |>
+head(8) |>
+mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) |>
+select(Collocate, logDice, pmi, ll) |>
+datatable(escape=F) |>
+formatRound(columns=~logDice + pmi + ll, digits=2)
```
# References