powered by
Replaces first/last names.
replace_names(x, names = textclean::drop_element(gsub("(^.)(.*)", "\\U\\1\\L\\2", c(lexicon::freq_last_names[[1]], lexicon::common_names), perl = TRUE), "^([AIU]n|[TSD]o|H[ea]Pa|Oh)$"), replacement = "", ...)
The text variable.
A vector of names to replace. This may be made more custom through a vector provided from a named entity extractor.
A string to replace names with.
Other arguments passed to replace_tokens.
replace_tokens
Returns a vector with names replaced.
# NOT RUN { x <- c( "Mary Smith is not here", "Karen is not a nice person", "Will will do it", NA ) replace_names(x) replace_names(x, replacement = '<<NAME>>') # }
Run the code above in your browser using DataLab