Skip to content

Consider switching to post-processing of special tokens #1503

Description

@koheiw

Post-processing is as fast as current pre-processing:

ndoc(corp)
##  [1] 84599
system.time({
toks <- stri_split_boundaries(texts(corp), 
                              type = "word", skip_word_none = FALSE) %>% 
        as.tokens() %>% 
        tokens_compound(phrase(c("# *", "@ #", "* -", "- *")), concatenator = "") %>% 
        tokens_remove("^[\\p{Z}\\p{C}]+$", valuetype = "regex")
})
##   user  system elapsed 
## 127.989  11.377  85.952 
system.time({
toks <- tokens(corp)
})
##    user  system elapsed 
##  98.810   2.519  77.285

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions