Spaces:
Sleeping
Sleeping
| # 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']}") | |