quanteda / spacyr
Showing 3 of 5 files from the diff.

@@ -451,7 +451,7 @@
Loading
451 451
spacy_pkgs <- function(version, packages = NULL) {
452 452
    if (is.null(packages))
453 453
        packages <- sprintf("spacy%s",
454 -
                            ifelse(version == "latest", "", paste0("==", version)))
454 +
                            ifelse(version == "latest", "", paste0("=", version)))
455 455
    return(packages)
456 456
}
457 457
@@ -536,12 +536,13 @@
Loading
536 536
            cat("spaCy will be upgraded to version", latest_spacy, "\n")
537 537
            process_spacy_installation_conda(conda = conda,
538 538
                                             envname = envname,
539 -
                                             version = "latest",
539 +
                                             version = latest_spacy,
540 540
                                             lang_models = lang_models,
541 541
                                             python_version = "3.6",
542 542
                                             prompt = FALSE)
543 543
            message("\nSuccessfully upgraded\n",
544 -
                    sprintf("Condaenv: %s; Langage model(s): ", envname), lang_models, "\n")
544 +
                    sprintf("Condaenv: %s; Langage model(s): ", envname), lang_models, "\n",
545 +
                    "For the upgrade to take effect, please restart R session")
545 546
        } else {
546 547
            if (pip == TRUE) {
547 548
                cmd <- sprintf("%s%s %s && pip install --upgrade %s %s%s",
@@ -584,13 +585,14 @@
Loading
584 585
            }
585 586
            process_spacy_installation_conda(conda = conda,
586 587
                                             envname = envname,
587 -
                                             version = "latest",
588 +
                                             version = latest_spacy,
588 589
                                             lang_models = lang_models,
589 590
                                             python_version = "3.6",
590 591
                                             prompt = FALSE,
591 592
                                             pip = pip)
592 593
            message("\nSuccessfully upgraded\n",
593 -
                    sprintf("Condaenv: %s; Langage model(s): ", envname), lang_models, "\n")
594 +
                    sprintf("Condaenv: %s; Langage model(s): ", envname), lang_models, "\n",
595 +
                    "For the upgrade to take effect, please restart R session")
594 596
595 597
        } else {
596 598
            message("No upgrade is chosen")

@@ -2,8 +2,8 @@
Loading
2 2
#' 
3 3
#' Initialize spaCy to call from R. 
4 4
#' @return NULL
5 -
#' @param model Language package for loading spaCy. Example: \code{en} (English) and
6 -
#' \code{de} (German). Default is \code{en}.
5 +
#' @param model Language package for loading spaCy. Example: \code{en_core_web_sm} (English) and
6 +
#' \code{de_core_web_sm} (German). Default is \code{en_core_web_sm}.
7 7
#' @param python_executable the full path to the Python executable, for which
8 8
#'   spaCy is installed
9 9
#' @param ask logical; if \code{FALSE}, use the first spaCy installation found;
@@ -27,7 +27,7 @@
Loading
27 27
#'   be saved for the future use.
28 28
#' @export
29 29
#' @author Akitaka Matsuo
30 -
spacy_initialize <- function(model = "en",
30 +
spacy_initialize <- function(model = "en_core_web_sm",
31 31
                             python_executable = NULL,
32 32
                             virtualenv = NULL,
33 33
                             condaenv = NULL,
@@ -129,7 +129,7 @@
Loading
129 129
#'  
130 130
#' @keywords internal
131 131
#' @importFrom data.table data.table
132 -
find_spacy <- function(model = "en", ask){
132 +
find_spacy <- function(model = "en_core_web_sm", ask){
133 133
    spacy_found <- `:=` <- NA
134 134
    spacy_python <- NULL
135 135
    options(warn = -1)

@@ -108,7 +108,7 @@
Loading
108 108
    if (lemma) {
109 109
        model <- spacyr_pyget("model")
110 110
        dt[, "lemma" := get_attrs(spacy_out, "lemma_", TRUE)]
111 -
        if (model != "en"){
111 +
        if (substr(model, 0, 2) != "en"){
112 112
            warning("lemmatization may not work properly in model '", model, "'")
113 113
        }
114 114
    }
Files Coverage
R 65.46%
Project Totals (13 files) 65.46%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading