We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This step will take a string/tokenlist and replace any emoji with a natural language label, that can then be used in downstream steps easier.
Should have a pre and post argument used to paste characters around the labels.
pre
post
library(emoji) library(tokenizers) library(textrecipes) token_x <- tokenize_words(emoji_samples$text, strip_punct = FALSE) emoji_swap <- function(x, emoji, label, pre = "_", post = "_") { emoji_ind <- emoji_detect(x) x[emoji_ind] <- paste0(pre, label[match(x[emoji_ind], emoji)], post) x } emoji_swap(token_x[[1]], emoji_name, names(emoji_name)) #> [1] "my" "_alarm_clock_" "didn’t" "work" #> [5] "." emoji_swap(token_x[[1]], emojis$emoji, emojis$group) #> [1] "my" "_Travel & Places_" "didn’t" #> [4] "work" "." emoji_swap(token_x[[1]], emojis$emoji, emojis$subgroup) #> [1] "my" "_time_" "didn’t" "work" "."
Created on 2021-07-29 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This step will take a string/tokenlist and replace any emoji with a natural language label, that can then be used in downstream steps easier.
Should have a
pre
andpost
argument used to paste characters around the labels.Created on 2021-07-29 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: