old version of selectFeatures.tokenizedTexts

Share:

Description

Calls C++ for super-fast selection or removal of features from a set of tokens.

Usage

1
2
3
4
5
6
selectFeaturesOLD(x, ...)

## S3 method for class 'tokenizedTexts'
selectFeaturesOLD(x, features, selection = c("keep",
  "remove"), valuetype = c("glob", "regex", "fixed"),
  case_insensitive = TRUE, verbose = TRUE, ...)

Arguments

x

object whose features will be selected

...

supplementary arguments passed to the underlying functions in stri_detect_regex. (This is how case_insensitive is passed, but you may wish to pass others.)

features

one of: a character vector of features to be selected, a dfm whose features will be used for selection, or a dictionary class object whose values (not keys) will provide the features to be selected. For dfm objects, see details in the Value section below.

selection

whether to keep or remove the features

valuetype

how to interpret feature vector: fixed for words as is; "regex" for regular expressions; or "glob" for "glob"-style wildcard

case_insensitive

ignore the case of dictionary values if TRUE

verbose

if TRUE print message about how many features were removed

Examples

1
2
3
4
toks <- tokenize(c("This is some example text from me.", "More of the example text."), 
                 removePunct = TRUE)
selectFeaturesOLD(toks, stopwords("english"), "remove")
selectFeaturesOLD(toks, "ex", "keep", valuetype = "regex")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.