File size: 498 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
# Test sarcasm detection
import sys
sys.path.insert(0, '.')

from avatar.sentiment_multi_emotion import MultiEmotionAnalyzer

a = MultiEmotionAnalyzer()

tests = [
    'Oh great, just what I needed',
    'Yeah, that is exactly what I wanted',
    'Oh wonderful',
    'Wow, fantastic',
    'Just perfect',
]

print("\nSarcasm Test Cases:")
print("-" * 60)
for t in tests:
    r = a.analyze(t)
    print(f"'{t}'")
    print(f"   polarity={r['polarity']} label={r['label']} base={r['base_emotion']}")