Add new methods modelName, serverVersion, vocabSize
Change-Id: I79f6e4169e4ac5e8d4eec115306ccd812eaaa909
diff --git a/NAMESPACE b/NAMESPACE
index 0a2f0f6..cc83af3 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -4,10 +4,14 @@
export(collocationScores)
export(cosineSimilarity)
export(countbasedCollocates)
+export(derekovecsApiCall)
export(derekovecsServer)
export(frequencyRank)
+export(modelName)
export(paradigmaticNeighbours)
+export(serverVersion)
export(syntagmaticNeighbours)
+export(vocabSize)
export(wordEmbedding)
importFrom(httr2,req_perform)
importFrom(httr2,req_url_path_append)
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()) %>%
diff --git a/man/modelName.Rd b/man/modelName.Rd
new file mode 100644
index 0000000..760be81
--- /dev/null
+++ b/man/modelName.Rd
@@ -0,0 +1,14 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/derekovecs.R
+\name{modelName}
+\alias{modelName}
+\title{Get model name}
+\usage{
+modelName()
+}
+\value{
+The name of the model.
+}
+\description{
+Get model name
+}
diff --git a/man/serverVersion.Rd b/man/serverVersion.Rd
new file mode 100644
index 0000000..53a7561
--- /dev/null
+++ b/man/serverVersion.Rd
@@ -0,0 +1,14 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/derekovecs.R
+\name{serverVersion}
+\alias{serverVersion}
+\title{Get derekovecs server version}
+\usage{
+serverVersion()
+}
+\value{
+The version of the derekovecs server.
+}
+\description{
+Get derekovecs server version
+}
diff --git a/man/vocabSize.Rd b/man/vocabSize.Rd
new file mode 100644
index 0000000..fc18282
--- /dev/null
+++ b/man/vocabSize.Rd
@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/derekovecs.R
+\name{vocabSize}
+\alias{vocabSize}
+\title{Get vocabulary size}
+\usage{
+vocabSize()
+}
+\value{
+The vocabulary size of the model.
+}
+\description{
+Get vocabulary size
+}
+\seealso{
+\code{\link[=frequencyRank]{frequencyRank()}}
+}