英文

情感分类从20个类别中

20个情感标签

id label
0 anger
1 cheeky
2 confuse
3 curious
4 disgust
5 empathetic
6 energetic
7 fear
8 grumpy
9 guilty
10 impatient
11 joy
12 love
13 neutral
14 sadness
15 serious
16 surprise
17 suspicious
18 think
19 whiny

如何使用

这是如何使用此模型获得给定文本的情感标签的方法:

from transformers import AutoModelForSequenceClassification, pipeline

model_name = 'jitesh/emotion-english'
model = AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = pipeline("text-classification", model=model, tokenizer=model_name)

text = "I can't wait any longer "

prediction = classifier(text)
print(prediction[0], text)

上述代码输出以下行。

{'label': 'impatient', 'score': 0.924211859703064} I can't wait any longer