模型:
avichr/hebEMO_trust
HebEMO 是一个能够从现代希伯来语的用户生成内容(UGC)中检测极性并提取情感的工具,它是在我们收集和标注的独特 Covid-19 相关数据集上进行训练的。
对于极性分类,HebEMO 的加权平均 F1 分数达到了 0.96 的高性能。情感检测的 F1 分数在 0.78-0.97 之间,只有“惊讶(surprise)”这一情感无法被模型捕捉(F1 = 0.41)。与其他语言相比,这些结果优于最佳报告性能,甚至包括英语。
我们的 UGC 数据包括从 2020 年 1 月至 2020 年 8 月收集的来自三个以色列主要新闻网站的新闻文章评论。数据总大小约为 150 MB,包含超过 700 万个单词和 35 万个句子。我们通过众包成员对约 2000 个句子(每个句子 3-10 个标注者)进行了整体情感(极性)和 eight emotions :愤怒、厌恶、期待、恐惧、喜悦、悲伤、惊讶和信任的标注。每种情感出现在句子中的百分比在下表中给出。
anger | disgust | expectation | fear | happy | sadness | surprise | trust | sentiment | |
---|---|---|---|---|---|---|---|---|---|
ratio | 0.78 | 0.83 | 0.58 | 0.45 | 0.12 | 0.59 | 0.17 | 0.11 | 0.25 |
emotion | f1-score | precision | recall |
---|---|---|---|
anger | 0.96 | 0.99 | 0.93 |
disgust | 0.97 | 0.98 | 0.96 |
anticipation | 0.82 | 0.80 | 0.87 |
fear | 0.79 | 0.88 | 0.72 |
joy | 0.90 | 0.97 | 0.84 |
sadness | 0.90 | 0.86 | 0.94 |
surprise | 0.40 | 0.44 | 0.37 |
trust | 0.83 | 0.86 | 0.80 |
以上指标为正类(即情感在文本中得到体现)。
precision | recall | f1-score | |
---|---|---|---|
neutral | 0.83 | 0.56 | 0.67 |
positive | 0.96 | 0.92 | 0.94 |
negative | 0.97 | 0.99 | 0.98 |
accuracy | 0.97 | ||
macro avg | 0.92 | 0.82 | 0.86 |
weighted avg | 0.96 | 0.97 | 0.96 |
情绪(极性)分析模型也可在 AWS 上获得!有关更多信息,请访问 AWS' git 。
在线模型可在 huggingface spaces 或作为 colab notebook 找到。
# !pip install pyplutchik==0.0.7 # !pip install transformers==4.14.1 !git clone https://github.com/avichaychriqui/HeBERT.git from HeBERT.src.HebEMO import * HebEMO_model = HebEMO() HebEMO_model.hebemo(input_path = 'data/text_example.txt') # return analyzed pandas.DataFrame hebEMO_df = HebEMO_model.hebemo(text='החיים יפים ומאושרים', plot=True)
from transformers import AutoTokenizer, AutoModel, pipeline tokenizer = AutoTokenizer.from_pretrained("avichr/heBERT_sentiment_analysis") #same as 'avichr/heBERT' tokenizer model = AutoModel.from_pretrained("avichr/heBERT_sentiment_analysis") # how to use? sentiment_analysis = pipeline( "sentiment-analysis", model="avichr/heBERT_sentiment_analysis", tokenizer="avichr/heBERT_sentiment_analysis", return_all_scores = True ) sentiment_analysis('אני מתלבט מה לאכול לארוחת צהריים') >>> [[{'label': 'neutral', 'score': 0.9978172183036804}, >>> {'label': 'positive', 'score': 0.0014792329166084528}, >>> {'label': 'negative', 'score': 0.0007035882445052266}]] sentiment_analysis('קפה זה טעים') >>> [[{'label': 'neutral', 'score': 0.00047328314394690096}, >>> {'label': 'possitive', 'score': 0.9994067549705505}, >>> {'label': 'negetive', 'score': 0.00011996887042187154}]] sentiment_analysis('אני לא אוהב את העולם') >>> [[{'label': 'neutral', 'score': 9.214012970915064e-05}, >>> {'label': 'possitive', 'score': 8.876807987689972e-05}, >>> {'label': 'negetive', 'score': 0.9998190999031067}]]
Avichay Chriqui Inbal yahav Coller Semitic Languages AI Lab 谢谢, תודה, شكرا
Chriqui, A., & Yahav, I. (2022). HeBERT & HebEMO: 一种希伯来语 BERT 模型和极性分析与情感识别工具。INFORMS Journal on Data Science, 即将发表。
@article{chriqui2021hebert, title={HeBERT \& HebEMO: a Hebrew BERT Model and a Tool for Polarity Analysis and Emotion Recognition}, author={Chriqui, Avihay and Yahav, Inbal}, journal={INFORMS Journal on Data Science}, year={2022} }