Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make spacy_download_langmodel work with multiple models (#249) #251

Merged
merged 2 commits into from
May 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading