Add webUiRequestUrl column also to corpusStats results
Change-Id: I412c5973f887af8d1592f5cc85b160d3e73ef959
diff --git a/R/KorAPCorpusStats.R b/R/KorAPCorpusStats.R
index a5665be..ab06382 100644
--- a/R/KorAPCorpusStats.R
+++ b/R/KorAPCorpusStats.R
@@ -11,7 +11,8 @@
#' @slot documents number of documents
#' @slot sentences number of sentences
#' @slot paragraphs number of paragraphs
-setClass("KorAPCorpusStats", slots=c(vc="character", documents="numeric", tokens="numeric", sentences="numeric", paragraphs="numeric"))
+#' @slot webUIRequestUrl link to the web user interface with the current vc definition
+setClass("KorAPCorpusStats", slots=c(vc="character", documents="numeric", tokens="numeric", sentences="numeric", paragraphs="numeric", webUIRequestUrl="character" ))
log_info <- function(v, ...) {
cat(ifelse(v, paste0(...), ""))
@@ -49,12 +50,13 @@
URLencode(enc2utf8(vc), reserved = TRUE))
log_info(verbose, "Getting size of virtual corpus \"", vc, "\"", sep = "")
res <- apiCall(kco, url)
+ webUIRequestUrl <- paste0(kco@KorAPUrl, sprintf("?q=<base/s=t>&cq=%s", URLencode(enc2utf8(vc))))
if(is.null(res)) {
res <- data.frame(documents=NA, tokens=NA, sentences=NA, paragraphs=NA)
}
log_info(verbose, ": ", res$tokens, " tokens\n")
if (as.df)
- data.frame(vc = vc, res, stringsAsFactors = FALSE)
+ data.frame(vc = vc, webUIRequestUrl = webUIRequestUrl, res, stringsAsFactors = FALSE)
else
new(
"KorAPCorpusStats",
@@ -62,7 +64,8 @@
documents = res$documents,
tokens = res$tokens,
sentences = res$sentences,
- paragraphs = res$paragraphs
+ paragraphs = res$paragraphs,
+ webUIRequestUrl = webUIRequestUrl
)
}
})
diff --git a/man/KorAPCorpusStats-class.Rd b/man/KorAPCorpusStats-class.Rd
index 243f769..b725ee4 100644
--- a/man/KorAPCorpusStats-class.Rd
+++ b/man/KorAPCorpusStats-class.Rd
@@ -27,5 +27,7 @@
\item{\code{sentences}}{number of sentences}
\item{\code{paragraphs}}{number of paragraphs}
+
+\item{\code{webUIRequestUrl}}{link to the web user interface with the current vc definition}
}}