blob: 24b6d89c2482c646a81609fe2115141cd36d4d94 [file] [log] [blame]
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, ...)
}