Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 1 | library(RKorAPClient) |
| 2 | library(tidyverse) |
| 3 | library(knitr) |
Marc Kupietz | 12cdcf7 | 2021-12-20 15:01:55 +0100 | [diff] [blame] | 4 | library(rmarkdown) |
Marc Kupietz | 1644e60 | 2021-12-19 16:27:40 +0100 | [diff] [blame] | 5 | |
| 6 | nodeWordform <- 'aufmerksam' |
| 7 | mdFile <- tempfile(nodeWordform, fileext = ".md") |
| 8 | |
Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 9 | new("KorAPConnection", verbose = TRUE) %>% |
| 10 | collocationAnalysis( |
Marc Kupietz | 1644e60 | 2021-12-19 16:27:40 +0100 | [diff] [blame] | 11 | nodeWordform, |
Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 12 | leftContextSize = 2, |
| 13 | rightContextSize = 2, |
| 14 | exactFrequencies = TRUE, |
| 15 | searchHitsSampleLimit = 1000, |
| 16 | topCollocatesLimit = 10, |
Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 17 | maxRecurse = 1, |
Marc Kupietz | 1644e60 | 2021-12-19 16:27:40 +0100 | [diff] [blame] | 18 | addExamples = TRUE |
Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 19 | ) %>% |
Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 20 | mutate(LVC = sprintf("[%s](%s)", example, webUIRequestUrl)) %>% |
| 21 | { . ->> ca } %>% |
| 22 | select(LVC, logDice, pmi, ll) %>% |
Marc Kupietz | 23004c6 | 2022-09-06 10:55:28 +0200 | [diff] [blame] | 23 | slice_head(50) %>% |
Marc Kupietz | 1644e60 | 2021-12-19 16:27:40 +0100 | [diff] [blame] | 24 | kable(format = "pipe", digits = 2) %>% |
| 25 | cat(file = mdFile, sep = "\n") |
Marc Kupietz | 5a336b6 | 2021-11-27 17:51:35 +0100 | [diff] [blame] | 26 | |
Marc Kupietz | 1644e60 | 2021-12-19 16:27:40 +0100 | [diff] [blame] | 27 | rmarkdown::render(mdFile) |
Marc Kupietz | ef74777 | 2022-09-06 10:59:16 +0200 | [diff] [blame] | 28 | browseURL(str_replace(mdFile, "\\.md$", ".html")) |