Spaces:
Sleeping
Sleeping
| # Quick debug script to analyze failing emotions | |
| import sys | |
| sys.path.insert(0, '.') | |
| from avatar.sentiment_multi_emotion import MultiEmotionAnalyzer | |
| a = MultiEmotionAnalyzer() | |
| tests = [ | |
| ('I feel so calm and peaceful', 'calm', 'positive'), | |
| ('I feel such affection for you', 'affection', 'positive'), | |
| ('Such tender feelings', 'tenderness', 'positive'), | |
| ('I feel compassion for them', 'compassion', 'positive'), | |
| ('I empathize with you', 'empathy', 'positive'), | |
| ('What a fascinating discovery!', 'fascination', 'positive'), | |
| ('I stand in awe of this', 'awe', 'positive'), | |
| ('This is intriguing', 'intrigue', 'positive'), | |
| ('I am in shock!', 'shock', 'neutral'), | |
| ('I am confused about this', 'confused', 'neutral'), | |
| ('I am puzzled by this', 'puzzled', 'neutral'), | |
| ] | |
| print("=" * 70) | |
| print("FAILING EMOTION ANALYSIS") | |
| print("=" * 70) | |
| print() | |
| for text, emotion, expected in tests: | |
| r = a.analyze(text) | |
| status = "✓" if r['polarity'] == expected else "✗" | |
| print(f"{status} {emotion:15} | expected: {expected:8} | got: {r['polarity']:8} | base: {r['base_emotion']:8} | label: {r['label']}") | |