Add recursion to collocationAnalysis
Change-Id: Ied5ab55f31f34048552ec0f0789b0b0175b2e4e0
diff --git a/demo/recursiveCA.R b/demo/recursiveCA.R
new file mode 100644
index 0000000..b121c49
--- /dev/null
+++ b/demo/recursiveCA.R
@@ -0,0 +1,26 @@
+library(RKorAPClient)
+library(tidyverse)
+library(knitr)
+new("KorAPConnection", verbose = TRUE) %>%
+ collocationAnalysis(
+ "aufmerksam",
+ leftContextSize = 2,
+ rightContextSize = 2,
+ exactFrequencies = TRUE,
+ searchHitsSampleLimit = 1000,
+ topCollocatesLimit = 10,
+# withinSpan = "",
+ maxRecurse = 1,
+ addExamples = T
+ ) %>%
+# mutate(LVC = sprintf("[aufmerksam %s](%s)", collocate, webUIRequestUrl)) %>%
+ { . ->> cax } %>%
+ mutate(LVC = sprintf("[%s](%s)", example, webUIRequestUrl)) %>%
+ { . ->> ca } %>%
+ select(LVC, logDice, pmi, ll) %>%
+ head(50) %>%
+ kable(format="pipe", digits=2) %>%
+ cat(file="/tmp/aufmerksam.md", sep="\n")
+
+rmarkdown::render("/tmp/aufmerksam.md")
+browseURL("/tmp/aufmerksam.html")