Skip to content

Commit faf776a

Browse files
committed
Do not cache 'ignore' words, fixes #30
1 parent 86eded7 commit faf776a

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: hunspell
22
Type: Package
33
Title: High-Performance Stemmer, Tokenizer, and Spell Checker for R
4-
Version: 2.7
4+
Version: 2.7.9000
55
Depends: R (>= 3.0.2)
66
Author: Jeroen Ooms
77
Maintainer: Jeroen Ooms <jeroen@berkeley.edu>

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2.8
2+
- Fix caching bug for 'ignore' argument in hunspell()
3+
14
2.7
25
- Update bundled en_US / en_GB dictionaries from libreoffice extensions
36
- Use Rcpp symbol registration / visibility

R/hunspell.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ hunspell <- function(text, format = c("text", "man", "latex", "html", "xml"),
9494
stopifnot(is.character(text))
9595
stopifnot(is.character(ignore))
9696
format <- match.arg(format)
97-
dictionary <- dictionary(dict)
98-
R_hunspell_find(dictionary, text, format, ignore)
97+
dictionary <- dictionary(dict, add_words = ignore)
98+
R_hunspell_find(dictionary, text, format, character())
9999
}
100100

101101
#for backward compatiblity
@@ -233,8 +233,11 @@ print.dictionary <- function(x, ...){
233233
#' @param cache speed up loading of dicationaries by caching
234234
#' @param add_words a character vector of additional words to add to the dictionary
235235
dictionary <- function(lang = "en_US", affix = NULL, cache = TRUE, add_words = NULL){
236-
if(inherits(lang, "dictionary"))
237-
return(lang)
236+
if(inherits(lang, "dictionary")){
237+
if(!length(add_words))
238+
return(lang)
239+
lang <- hunspell_info(lang)$dict
240+
}
238241
if(!isTRUE(cache))
239242
return(dictionary_internal(lang, affix, add_words))
240243
key <- digest::digest(list(lang, affix, add_words))

0 commit comments

Comments
 (0)