This would resolve the inefficiency noted here but with a general solution. I actually started writing this based on the (internal) tokens_segment() but then went for a quicker fix since I only needed an internal hyphen solution for
|
if (remove_hyphens && any(stri_detect_regex(types(x), "^.+-.+$"))) { |
|
x <- lapply(as.list(x), function(y) |
|
as.character(tokens(as.character(y), remove_hyphens = TRUE))) %>% |
|
as.tokens() |
|
} |
Proposal:
tokens_split(x, pattern, valuetype = c("glob", "regex", "fixed"),
case_insensitive = TRUE, keep_pattern = FALSE)
which would be the opposite direction, otherwise similar behaviour, to tokens_compound().
This would resolve the inefficiency noted here but with a general solution. I actually started writing this based on the (internal)
tokens_segment()but then went for a quicker fix since I only needed an internal hyphen solution forquanteda/R/tokens.R
Lines 221 to 225 in 0dc5b34
Proposal:
which would be the opposite direction, otherwise similar behaviour, to
tokens_compound().