predict_emotion_with_emoji | R Documentation |
This function takes input text, preprocesses it, extracts TF-IDF features using a pre-trained model, predicts the emotion using a trained classifier, and returns the result with optional emoji representation.
predict_emotion_with_emoji(text, output_type = "textemoji")
text |
Character string containing the text to analyze. |
output_type |
Type of output to return. Must be one of:
|
Depending on output_type:
For "emotion": character string of predicted emotion
For "emoji": character string of corresponding emoji
For "textemoji": original text with appended emoji
The function also prints the result to console.
## Not run:
# This example is not run because it requires manually downloading
# a large external model (~30MB), which cannot be retrieved automatically
# and may fail in offline environments.
predict_emotion_with_emoji("I'm so happy today!")
predict_emotion_with_emoji("This makes me angry", "emoji")
predict_emotion_with_emoji("I feel scared", "emotion")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.