match_tokens {textclean} | R Documentation |
Find Tokens that Match a Regex
Description
Given a text, find all the tokens that match a regex(es). This function is
particularly useful with replace_tokens
.
Usage
match_tokens(x, pattern, ignore.case = TRUE, ...)
Arguments
x |
A character vector. |
pattern |
Character string(s) to be matched in the given character vector. |
ignore.case |
logical. If |
... |
ignored. |
Value
Returns a vector of tokens from a text matching a specific regex pattern.
See Also
Examples
with(DATA, match_tokens(state, c('^li', 'ou')))
with(DATA, match_tokens(state, c('^Th', '^I'), ignore.case = TRUE))
with(DATA, match_tokens(state, c('^Th', '^I'), ignore.case = FALSE))
[Package textclean version 0.9.3 Index]