Skip to content

Need (internal?) tokens_split() #1500

Description

@kbenoit

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

quanteda/R/tokens.R

Lines 221 to 225 in 0dc5b34

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().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions