模型:
avichr/heBERT_sentiment_analysis
HeBERT是一种希伯来语预训练语言模型。它基于Google的BERT架构,并采用了BERT-Base配置 (Devlin et al. 2018) 。
HeBERT在以下三个数据集上进行了训练:
我们的用户生成内容(UGC)是从3个主要新闻网站收集的文章评论,时间跨度为2020年1月至2020年8月,数据总大小约为150MB,包括700万个词和35万个句子。我们请众包成员(每个句子3-10个标注员)为8种情感(愤怒、厌恶、期待、恐惧、快乐、悲伤、惊讶和信任)和整体情感/极性标注了4000个句子。为了验证标注,我们使用Krippendorff's alpha寻找每个句子中标注者对情感的一致性。我们保留了得到alpha > 0.7的句子。需要注意的是,虽然我们发现标注者对快乐、信任和厌恶等情感存在普遍一致性,但在某些情感上存在普遍的不一致性,似乎是由于在文本中寻找这些情感的复杂性(例如期待和惊讶)。
precision | recall | f1-score | |
---|---|---|---|
natural | 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 |
from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("avichr/heBERT") model = AutoModel.from_pretrained("avichr/heBERT") from transformers import pipeline fill_mask = pipeline( "fill-mask", model="avichr/heBERT", tokenizer="avichr/heBERT" ) fill_mask("הקורונה לקחה את [MASK] ולנו לא נשאר דבר.")
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': 'natural', 'score': 0.9978172183036804}, {'label': 'positive', 'score': 0.0014792329166084528}, {'label': 'negative', 'score': 0.0007035882445052266}]] >>> sentiment_analysis('קפה זה טעים') [[{'label': 'natural', 'score': 0.00047328314394690096}, {'label': 'possitive', 'score': 0.9994067549705505}, {'label': 'negetive', 'score': 0.00011996887042187154}]] >>> sentiment_analysis('אני לא אוהב את העולם') [[{'label': 'natural', 'score': 9.214012970915064e-05}, {'label': 'possitive', 'score': 8.876807987689972e-05}, {'label': 'negetive', 'score': 0.9998190999031067}]]
我们的模型也可在AWS上使用!有关更多信息,请访问 AWS' git
我们仍在努力改进我们的模型,并将随着进展更新此页面。请注意,目前我们只发布了情感分析(极性),情感检测将稍后发布。我们的git: https://github.com/avichaychriqui/HeBERT
Chriqui, A., & Yahav, I. (2021). HeBERT & HebEMO: a Hebrew BERT Model and a Tool for Polarity Analysis and Emotion Recognition. arXiv preprint arXiv:2102.01909.
@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={arXiv preprint arXiv:2102.01909}, year={2021} }