Skip to content

Commit

Permalink
Merge pull request #251 from JBGruber/master
Browse files Browse the repository at this point in the history
make spacy_download_langmodel work with multiple models (#249)
  • Loading branch information
kbenoit authored May 18, 2024
2 parents 1ce5458 + d1b3dc3 commit 6df75a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: spacyr
Type: Package
Title: Wrapper to the 'spaCy' 'NLP' Library
Version: 1.3.0
Version: 1.3.1
Authors@R: c(
person("Kenneth", "Benoit", email = "[email protected]", role = c("cre", "aut", "cph"), comment = c(ORCID = "0000-0002-0797-564X")),
person("Akitaka", "Matsuo", email = "[email protected]", role = "aut", comment = c(ORCID = "0000-0002-3323-6330")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# spacyr v1.3.1

* Fixed a bug in `spacy_download_langmodel()` that prevented installing multiple models in one function call (#249)

# spacyr v1.3

* Overhauled the `spacy_install()` and `spacy_uninstall()` functions to provide a more modern and robust installation procedure.
Expand Down
6 changes: 4 additions & 2 deletions R/spacy_langmodel_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
spacy_download_langmodel <- function(lang_models = "en_core_web_sm",
force = FALSE) {

if (!force & py_check_installed(lang_models)) {
if (!force & all(py_check_installed(lang_models))) {
warning("Skipping installation. Use `force` to force installation or update.")
return(invisible(NULL))
} else if (!force & any(py_check_installed(lang_models))) {
warning("Skipping installation of one or more models. Use `force` to force installation or update.")
lang_models <- lang_models[!py_check_installed(lang_models)]
}


bin <- Sys.getenv("RETICULATE_PYTHON", unset = reticulate::virtualenv_python(
Sys.getenv("SPACY_PYTHON", unset = "r-spacyr")
))
Expand Down

0 comments on commit 6df75a7

Please sign in to comment.