Skip to content

Add tokens_keep and dfm_keep? #1037

Description

@koheiw

We have tokens_remove(), which is a shortcut to tokens_select(x, selection = 'remove'), but not tokens_keep(). It makes our life easier, especially with regex patters.

For example, we have to write to keep capitalized words

tokens_select(toks, '^[A-Z]', 'keep', 'regex', FALSE)
# or 
tokens_select(toks, '^[A-Z]', valuetype = 'regex', case_insensitive = FALSE)

These become just

tokens_keep(toks, '^[A-Z]', 'regex', FALSE)

The same apply to dfm_select().

Am I too lazy?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions