Stub import
Change-Id: I2f9ac417325c91b2c0318b3a94b9010a70c400aa
diff --git a/R/derekovecs.R b/R/derekovecs.R
new file mode 100644
index 0000000..24b6d89
--- /dev/null
+++ b/R/derekovecs.R
@@ -0,0 +1,32 @@
+library(httr2)
+library(tidyverse)
+
+derekovecs_server = 'https://corpora.ids-mannheim.de/openlab/derekovecs/'
+
+DeReKoVecsCall <- function(method="", ...) {
+ request(derekovecs_server) %>%
+ req_url_path_append(method) %>%
+ req_url_query(...) %>%
+ req_perform() %>%
+ resp_body_json(simplifyVector = TRUE)
+}
+
+syntagmaticNeighbours <- function(word = "Test", ...) {
+ DeReKoVecsCall("", word=word, json=1, ...)$collocators
+}
+
+countbasedCollocates <- function(w = "Test", ...) {
+ DeReKoVecsCall(method = "/getClassicCollocators", w = w, ...)$collocates
+}
+
+paradigmaticNeighbours <- function(word = "Test", ...) {
+ DeReKoVecsCall("", word=word, json=1, ...)$list[[1]]
+}
+
+collocationScores <- function(w, c, ...) {
+ DeReKoVecsCall("/getCollocationAssociation", w=w, c=c, ...)$collocates
+}
+
+cosineSimilarity <- function(w1, w2, ...) {
+ DeReKoVecsCall("/getSimilarity", w1=w1, w2=w2, ...)
+}