predict_emotion_with_emoji {text2emotion}R Documentation

Predict Emotion with Emoji Representation

Description

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.

Usage

predict_emotion_with_emoji(text, output_type = "textemoji")

Arguments

text

Character string containing the text to analyze.

output_type

Type of output to return. Must be one of:

  • "emotion" - returns only the predicted emotion label

  • "emoji" - returns only the corresponding emoji

  • "textemoji" - returns original text appended with predicted emoji (default)

Value

Depending on output_type:

The function also prints the result to console.

Examples

## 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)


[Package text2emotion version 0.1.0 Index]