File size: 6,647 Bytes
25e624c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
"""
Sentiment Emoji Map - Maps emotion labels to face emojis

This module maps detected emotions to visual emoji representations
Unified for both user and AI (same emojis for all)

Version 2.0: Added new emotions for multi-emotion model support
"""

from typing import Dict, Optional


class EmojiMapper:
    """Maps emotion labels to face emojis - unified for user and AI"""
    
    EMOTION_EMOJIS: Dict[str, str] = {
        # === POSITIVE EMOTIONS (High Arousal) ===
        "ecstasy": "๐Ÿคฉ",
        "joy": "๐Ÿ˜",
        "happiness": "๐Ÿ˜Š",
        "delight": "๐Ÿ˜„",
        "elation": "๐Ÿ˜†",
        "euphoria": "๐Ÿฅณ",
        "excitement": "๐Ÿ˜ƒ",
        "thrill": "๐Ÿ˜",
        "enthusiasm": "๐Ÿ˜€",
        "cheerfulness": "๐Ÿ˜Š",
        
        # === POSITIVE EMOTIONS (Medium Arousal) ===
        "contentment": "๐Ÿ˜Œ",
        "satisfaction": "๐Ÿ˜",
        "pleasure": "๐Ÿ˜‹",
        "relief": "๐Ÿ˜ฎโ€๐Ÿ’จ",
        "serenity": "๐Ÿ˜‡",
        "calm": "๐Ÿ˜Œ",
        "relaxed": "๐Ÿ˜Ž",
        "pride": "๐Ÿ˜ค",
        "confidence": "๐Ÿ˜Ž",
        "triumph": "๐Ÿ˜",
        
        # === LOVE & AFFECTION ===
        "love": "๐Ÿฅฐ",
        "adoration": "๐Ÿ˜",
        "affection": "๐Ÿฅฐ",
        "tenderness": "๐Ÿค—",
        "caring": "๐Ÿค—",
        "compassion": "๐Ÿฅน",
        "empathy": "๐Ÿฅน",
        "gratitude": "๐Ÿ™",
        "thankful": "๐Ÿ˜Š",
        
        # === INTEREST & CURIOSITY ===
        "curiosity": "๐Ÿง",
        "interest": "๐Ÿค”",
        "fascination": "๐Ÿ˜ฏ",
        "wonder": "๐Ÿ˜ฒ",
        "awe": "๐Ÿ˜ฎ",
        "amazement": "๐Ÿ˜ฒ",
        "intrigue": "๐Ÿคจ",
        
        # === SURPRISE ===
        "surprise": "๐Ÿ˜ฎ",
        "astonishment": "๐Ÿ˜ฑ",
        "shock": "๐Ÿ˜ณ",
        "startled": "๐Ÿ˜ง",
        
        # === NEUTRAL / THINKING ===
        "neutral": "๐Ÿ˜",
        "thinking": "๐Ÿค”",
        "contemplative": "๐Ÿค”",
        "pensive": "๐Ÿ˜”",
        "reflective": "๐Ÿค”",
        "uncertain": "๐Ÿ˜•",
        "ambivalent": "๐Ÿ˜",
        "indifferent": "๐Ÿ˜‘",
        
        # === CONFUSION ===
        "confused": "๐Ÿ˜•",
        "confusion": "๐Ÿ˜•",
        "puzzled": "๐Ÿคจ",
        "perplexed": "๐Ÿ˜ตโ€๐Ÿ’ซ",
        "bewildered": "๐Ÿ˜ต",
        "baffled": "๐Ÿคฏ",
        
        # === NEGATIVE EMOTIONS (Low Arousal) ===
        "sadness": "๐Ÿ˜ข",
        "sorrow": "๐Ÿ˜ญ",
        "grief": "๐Ÿ˜ญ",
        "melancholy": "๐Ÿ˜”",
        "disappointment": "๐Ÿ˜ž",
        "dejection": "๐Ÿ˜ฉ",
        "despair": "๐Ÿ˜ซ",
        "hopelessness": "๐Ÿ˜ฟ",
        "loneliness": "๐Ÿฅบ",
        "hurt": "๐Ÿ˜ข",
        "misery": "๐Ÿ˜ฃ",
        
        # === FEAR & ANXIETY ===
        "fear": "๐Ÿ˜จ",
        "terror": "๐Ÿ˜ฑ",
        "horror": "๐Ÿ˜ฑ",
        "dread": "๐Ÿ˜ฐ",
        "anxiety": "๐Ÿ˜ฐ",
        "worry": "๐Ÿ˜Ÿ",
        "nervousness": "๐Ÿ˜ฌ",
        "apprehension": "๐Ÿ˜ง",
        "panic": "๐Ÿ˜ฑ",
        
        # === ANGER & FRUSTRATION ===
        "anger": "๐Ÿ˜ ",
        "rage": "๐Ÿคฌ",
        "fury": "๐Ÿ˜ก",
        "irritation": "๐Ÿ˜ค",
        "annoyance": "๐Ÿ™„",
        "frustration": "๐Ÿ˜ค",
        "exasperation": "๐Ÿ˜ซ",
        "resentment": "๐Ÿ˜’",
        "hostility": "๐Ÿ˜ ",
        "bitterness": "๐Ÿ˜–",
        
        # === DISGUST & CONTEMPT ===
        "disgust": "๐Ÿคข",
        "revulsion": "๐Ÿคฎ",
        "contempt": "๐Ÿ˜’",
        "disdain": "๐Ÿ™„",
        "loathing": "๐Ÿ˜ค",
        "scorn": "๐Ÿ˜",
        
        # === SHAME & EMBARRASSMENT ===
        "shame": "๐Ÿ˜ณ",
        "embarrassment": "๐Ÿ˜ณ",
        "guilt": "๐Ÿ˜ฃ",
        "regret": "๐Ÿ˜”",
        "remorse": "๐Ÿ˜ž",
        "humiliation": "๐Ÿซฃ",
        
        # === BOREDOM & TIREDNESS ===
        "boredom": "๐Ÿ˜‘",
        "tiredness": "๐Ÿ˜ด",
        "exhaustion": "๐Ÿ˜ฉ",
        "fatigue": "๐Ÿฅฑ",
        "weariness": "๐Ÿ˜ฎโ€๐Ÿ’จ",
        "sleepy": "๐Ÿ˜ด",
        
        # === ENVY & JEALOUSY ===
        "envy": "๐Ÿ˜’",
        "jealousy": "๐Ÿ™„",
        
        # === PLAYFUL & SILLY ===
        "playful": "๐Ÿ˜œ",
        "silly": "๐Ÿคช",
        "mischievous": "๐Ÿ˜ˆ",
        "teasing": "๐Ÿ˜",
        "sarcastic": "๐Ÿ˜",
        "witty": "๐Ÿ˜Ž",
        "amusement": "๐Ÿ˜‚",
        "funny": "๐Ÿคฃ",
        
        # === SPECIAL STATES ===
        "sympathy": "๐Ÿฅน",
        "nostalgia": "๐Ÿฅฒ",
        "hope": "๐Ÿ™‚",
        "optimism": "๐Ÿ˜Š",
        "pessimism": "๐Ÿ˜•",
        "longing": "๐Ÿฅบ",
        "yearning": "๐Ÿ˜ข",
        
        # === NEW IN V2 ===
        "determination": "๐Ÿ˜ค",
        "inspiration": "๐Ÿคฉ",  # Changed from โœจ to face emoji
        "anticipation": "๐Ÿค—",
        "trust": "๐Ÿ˜Š",  # Changed from ๐Ÿค to face emoji
        "acceptance": "๐Ÿ˜Œ",
        "sarcasm": "๐Ÿ™„",
        
        # === NEW IN V3 - Context Emotions ===
        "indifferent": "๐Ÿ˜",
        "admiration": "๐Ÿคฉ",
        "despair": "๐Ÿ˜ฐ",
        "greeting": "๐Ÿ˜Š",  # Changed from ๐Ÿ‘‹ to face emoji
        "heartbreak": "๐Ÿ˜ญ",  # Changed from ๐Ÿ’” to face emoji,
        
        # === LEGACY MAPPINGS ===
        "very_negative": "๐Ÿ˜ญ",
        "negative": "๐Ÿ˜ ",
        "slightly_negative": "๐Ÿ˜•",
        "slightly_positive": "๐Ÿ™‚",
        "positive": "๐Ÿ˜Š",
        "very_positive": "๐Ÿคฉ",
        
        # Default
        "default": "๐Ÿ˜",
        "ready": "๐Ÿ˜",
    }
    
    def __init__(self, custom_emojis: Optional[Dict[str, str]] = None):
        """Initialize with default or custom emoji mappings"""
        self.emojis = self.EMOTION_EMOJIS.copy()
        if custom_emojis:
            self.emojis.update(custom_emojis)
    
    def get_emoji(self, emotion: str) -> str:
        """
        Get emoji for a given emotion
        
        Args:
            emotion: Emotion label (e.g., 'joy', 'anger', 'curiosity')
            
        Returns:
            Face emoji string
        """
        emotion_clean = emotion.lower().strip().replace(" ", "_").replace("-", "_")
        return self.emojis.get(emotion_clean, self.emojis.get("default", "๐Ÿ˜"))
    
    def get_all_emojis(self) -> Dict[str, str]:
        """Get all emotionโ†’emoji mappings"""
        return self.emojis.copy()


if __name__ == "__main__":
    mapper = EmojiMapper()
    test_emotions = [
        "joy", "happiness", "love", "sadness", "anger",
        "fear", "surprise", "disgust", "curiosity", "neutral"
    ]
    
    print("Emotion โ†’ Emoji Mappings:")
    for emotion in test_emotions:
        emoji = mapper.get_emoji(emotion)
        print(f"  {emotion:20} โ†’ {emoji}")
    
    print(f"\nTotal emotions: {len(mapper.get_all_emojis())}")