Views
No views yet
bert-base-cased model for classifying emotions in text
into six categories: sadness, joy, love, anger, fear, and surprise.1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="gabe-zhang/twitter-emotion-bert",
6)
7
8classifier("I am so happy today!")
9# [{'label': 'joy', 'score': 0.95}]
10
11classifier("This makes me really angry")
12# [{'label': 'anger', 'score': 0.89}]| ID | Emotion |
|---|---|
| 0 | sadness |
| 1 | joy |
| 2 | love |
| 3 | anger |
| 4 | fear |
| 5 | surprise |
| Emotion | Precision | Recall | F1-Score |
|---|---|---|---|
| Sadness | 0.94 | 0.93 | 0.93 |
| Joy | 0.95 | 0.96 | 0.95 |
| Love | 0.86 | 0.89 | 0.87 |
| Anger | 0.93 | 0.90 | 0.91 |
| Fear | 0.91 | 0.89 | 0.90 |
| Surprise | 0.85 | 0.82 | 0.83 |
bert-base-cased