Add new methods modelName, serverVersion, vocabSize
Change-Id: I79f6e4169e4ac5e8d4eec115306ccd812eaaa909
diff --git a/R/derekovecs.R b/R/derekovecs.R
index 721d79d..5d61f2c 100644
--- a/R/derekovecs.R
+++ b/R/derekovecs.R
@@ -69,11 +69,32 @@
#' @param ... Additional parameters to pass to the API.
#' @return Frequency rank.
#' @export
-#'
frequencyRank <- function(word = "Test", ...) {
derekovecsApiCall("/getWord", w = word, ...)$frequencyRank
}
+#' Get derekovecs server version
+#' @return The version of the derekovecs server.
+#' @export
+serverVersion <- function() {
+ derekovecsApiCall("/getVersion")
+}
+
+#' Get vocabulary size
+#' @return The vocabulary size of the model.
+#' @export
+#' @seealso [frequencyRank()]
+vocabSize <- function() {
+ derekovecsApiCall("/getVocabSize")
+}
+
+#' Get model name
+#' @return The name of the model.
+#' @export
+modelName <- function() {
+ derekovecsApiCall("/getModelName")
+}
+
#' Get collocation scores
#'
#' Calculate the association scores between a node (target word) and words in a window around the it.
@@ -156,6 +177,7 @@
#' @importFrom httr2 request req_url_path_append req_url_query req_perform resp_body_json
#'
#' @include utils-pipe.R
+#' @export
#'
derekovecsApiCall <- function(method = "", ...) {
httr2::request(derekovecsServer()) %>%