CA: Make recurive CA association score threshold a parameter
Currently logDice >= 2.0
Change-Id: I6173ce3acb5d2e5a3f1aa1cbc41367cce59eee44
diff --git a/R/collocationAnalysis.R b/R/collocationAnalysis.R
index a10faf8..f5dd559 100644
--- a/R/collocationAnalysis.R
+++ b/R/collocationAnalysis.R
@@ -81,6 +81,8 @@
expand = length(vc) != length(node),
maxRecurse = 0,
addExamples = TRUE,
+ thresholdScore = "logDice",
+ threshold = 2.0,
localStopwords = c(),
...) {
# https://stackoverflow.com/questions/8096313/no-visible-binding-for-global-variable-note-in-r-cmd-check
@@ -154,9 +156,9 @@
tibble()
}
}
- if (maxRecurse > 0 & any( result$logDice >= 2) ) {
+ if (maxRecurse > 0 & any(!!as.name(thresholdScore) >= threshold)) {
recurseWith <- result %>%
- filter(logDice >= 2)
+ filter(!!as.name(thresholdScore) >= threshold)
result <- collocationAnalysis(
kco,
node = paste0("(", buildCollocationQuery(
diff --git a/man/collocationAnalysis-KorAPConnection-method.Rd b/man/collocationAnalysis-KorAPConnection-method.Rd
index 347909e..1862f21 100644
--- a/man/collocationAnalysis-KorAPConnection-method.Rd
+++ b/man/collocationAnalysis-KorAPConnection-method.Rd
@@ -23,6 +23,8 @@
expand = length(vc) != length(node),
maxRecurse = 0,
addExamples = TRUE,
+ thresholdScore = "logDice",
+ threshold = 2,
localStopwords = c(),
...
)