Public Repository

Last pushed: a year ago
Short Description
Emotion detection from text based on emotion hash tags in Twitter.
Full Description

This module takes in a sentence or a tweet and predicts if emotions are present in it or not. This plugin detects the presence of emotions following the Ekman emotion categories:
sadness, disgust, surprise, anger, fear, joy.

A separate Linear SVM Classifier is used for each emotion. The classifiers are trained using Saif Mohommad's the Hashtag Emotion Corpus, which contains tweets ending in a hash tag of one of the 6 basic emotions. The emotion hash tags were removed from the tweets before training.

Expected parameters: a sentence, or a tweet.

There are two options: SVC and LinearSVC.
The SVC model returns an intensity (0 to 100) for each ekman emotion as well as a VAD estimate (weighted average of emotions).
The LinearSVC model returns presence of ekman emotions (possibly more than one) and a VAD estimate (average of present emotions)

They both use the format with one emotion evaluation (either VAD or an ekman emotion) per onyx:hasEmotion entry.
This is a little different to the old ANEW module from UPM. It’s not really possible to make ours the same as that one, as we can have multiple detected Ekman emotions.

GitHub:
https://github.com/MixedEmotions/05_emotion_hashtags_nuig

Example usage:
http://127.0.0.1:8005/api/?algo=hashTagClassification&i=This%20text%20makes%20me%20sad.%0Awhilst%20this%20text%20makes%20me%20happy%20and%20surprised%20at%20the%20same%20time.%0AI%20cannot%20believe%20it!&estimator=LinearSVC

Example output:
{
"@context": "http://140.203.155.26:8005/api/contexts/Results.jsonld",
"@id": "_:Results_1488478786.0993345",
"@type": "results",
"analysis": [
"hashTagClassification"
],
"entries": [
{
"@id": "_:Entry_1488478788.7637525",
"@type": "entry",
"emotions": [
{
"@id": "Emotions",
"@type": "emotionSet",
"onyx:hasEmotion": [
{
"@id": "_:Emotion_1488478788.7638373",
"@type": "emotion",
"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.095348837209301,
"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 4.336395348837209,
"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 4.63906976744186
},
{
"@id": "_:Emotion_1488478788.7641711",
"@type": "emotion",
"onyx:hasEmotionCategory": "surprise",
"onyx:hasEmotionIntensity": 11
},
{
"@id": "_:Emotion_1488478788.764206",
"@type": "emotion",
"onyx:hasEmotionCategory": "fear",
"onyx:hasEmotionIntensity": 1
},
{
"@id": "_:Emotion_1488478788.7642345",
"@type": "emotion",
"onyx:hasEmotionCategory": "anger",
"onyx:hasEmotionIntensity": 6
},
{
"@id": "_:Emotion_1488478788.764262",
"@type": "emotion",
"onyx:hasEmotionCategory": "disgust",
"onyx:hasEmotionIntensity": 1
},
{
"@id": "_:Emotion_1488478788.7642891",
"@type": "emotion",
"onyx:hasEmotionCategory": "sadness",
"onyx:hasEmotionIntensity": 46
},
{
"@id": "_:Emotion_1488478788.7643168",
"@type": "emotion",
"onyx:hasEmotionCategory": "joy",
"onyx:hasEmotionIntensity": 32
}
]
}
],
"entities": [],
"nif:isString": "This text makes me sad.\nwhilst this text makes me happy and surprised at the same time.\nI cannot believe it!",
"sentiments": [],
"suggestions": [],
"topics": []
}
]
}

Docker Pull Command
Owner
mixedemotions