Skip to content

Commit

Permalink
Merge pull request #6 from Displayr/feature/INF-5
Browse files Browse the repository at this point in the history
Improve the download CoreNLP function
  • Loading branch information
mlau-displayr committed Aug 20, 2021
2 parents 7981b58 + 6a56a13 commit 18ab970
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions R/download.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,32 @@
#' to model files (which are unzipped).
#' @param force logical. Should files be downloaded if they appear
#' to already exist?
#' @param baseURL the url that contains the required CoreNLP packages
#' @param coreFile the name of the zip and jar (without extentsion)
#'
#'
#'@examples
#'\dontrun{
#'cnlp_download_corenlp()
#'cnlp_download_corenlp(type="spanish")
#'cnlp_download_corenlp(baseURL=`https://displayrreuspackagecache.blob.core.windows.net/r-package-cache`)
#'}
#' @importFrom utils download.file
#' @export
cnlp_download_corenlp <- function(
type = c("default", "base", "en"),
output_loc, url = NULL, url_core = TRUE, force = FALSE) {
type = c("default", "base", "en"),
output_loc,
url = NULL,
url_core = TRUE,
force = FALSE,
baseURL = "https://downloads.cs.stanford.edu/nlp/software",
coreFile = "stanford-corenlp-full-2018-10-05"
) {

op <- options(timeout = 600)
op <- options(timeout = 900)
on.exit(options(op))

# set defaults and determine where files should be saved
baseURL <- "https://downloads.cs.stanford.edu/nlp/software"
coreFile <- "stanford-corenlp-full-2018-10-05"
# Determine where files should be saved
if (missing(output_loc)) {
output_loc <- system.file("extdata", package="cleanNLP")
if (file.access(output_loc, "6") == -1)
Expand Down

0 comments on commit 18ab970

Please sign in to comment.