情緒分析系統(tǒng)來了,還開源
點(diǎn)擊上方藍(lán)色字體,選擇“標(biāo)星公眾號(hào)”
優(yōu)質(zhì)文章,第一時(shí)間送達(dá)
66套java從入門到精通實(shí)戰(zhàn)課程分享
百度最近開源了情緒分析系統(tǒng),比較厲害,算法強(qiáng)大,大伙自己看吧!

gitee開源地址:
https://gitee.com/baidu/Senta

目錄
簡介
SKEP
代碼結(jié)構(gòu)
一鍵化工具
詳細(xì)使用說明
Demo數(shù)據(jù)集說明
論文效果復(fù)現(xiàn)
文獻(xiàn)引用
簡介
情感分析旨在自動(dòng)識(shí)別和提取文本中的傾向、立場、評價(jià)、觀點(diǎn)等主觀信息。它包含各式各樣的任務(wù),比如句子級(jí)情感分類、評價(jià)對象級(jí)情感分類、觀點(diǎn)抽取、情緒分類等。情感分析是人工智能的重要研究方向,具有很高的學(xué)術(shù)價(jià)值。同時(shí),情感分析在消費(fèi)決策、輿情分析、個(gè)性化推薦等領(lǐng)域均有重要的應(yīng)用,具有很高的商業(yè)價(jià)值。
近日,百度正式發(fā)布情感預(yù)訓(xùn)練模型SKEP(Sentiment Knowledge Enhanced Pre-training for Sentiment Analysis)。SKEP利用情感知識(shí)增強(qiáng)預(yù)訓(xùn)練模型, 在14項(xiàng)中英情感分析典型任務(wù)上全面超越SOTA,此工作已經(jīng)被ACL 2020錄用。
論文地址:https://arxiv.org/abs/2005.05635
為了方便研發(fā)人員和商業(yè)合作伙伴共享效果領(lǐng)先的情感分析技術(shù),本次百度在Senta中開源了基于SKEP的情感預(yù)訓(xùn)練代碼和中英情感預(yù)訓(xùn)練模型。而且,為了進(jìn)一步降低用戶的使用門檻,百度在SKEP開源項(xiàng)目中集成了面向產(chǎn)業(yè)化的一鍵式情感分析預(yù)測工具。用戶只需要幾行代碼即可實(shí)現(xiàn)基于SKEP的情感預(yù)訓(xùn)練以及模型預(yù)測功能。
SKEP
SKEP是百度研究團(tuán)隊(duì)提出的基于情感知識(shí)增強(qiáng)的情感預(yù)訓(xùn)練算法,此算法采用無監(jiān)督方法自動(dòng)挖掘情感知識(shí),然后利用情感知識(shí)構(gòu)建預(yù)訓(xùn)練目標(biāo),從而讓機(jī)器學(xué)會(huì)理解情感語義。SKEP為各類情感分析任務(wù)提供統(tǒng)一且強(qiáng)大的情感語義表示。
百度研究團(tuán)隊(duì)在三個(gè)典型情感分析任務(wù),句子級(jí)情感分類(Sentence-level Sentiment Classification),評價(jià)對象級(jí)情感分類(Aspect-level Sentiment Classification)、觀點(diǎn)抽?。∣pinion Role Labeling),共計(jì)14個(gè)中英文數(shù)據(jù)上進(jìn)一步驗(yàn)證了情感預(yù)訓(xùn)練模型SKEP的效果。實(shí)驗(yàn)表明,以通用預(yù)訓(xùn)練模型ERNIE(內(nèi)部版本)作為初始化,SKEP相比ERNIE平均提升約1.2%,并且較原SOTA平均提升約2%,具體效果如下表:
| 任務(wù) | 數(shù)據(jù)集合 | 語言 | 指標(biāo) | 原SOTA | SKEP | 數(shù)據(jù)集地址 |
| 句子級(jí)情感 分類 | SST-2 | 英文 | ACC | 97.50 | 97.60 | 下載地址 |
| Amazon-2 | 英文 | ACC | 97.37 | 97.61 | 下載地址 | |
| ChnSentiCorp | 中文 | ACC | 95.80 | 96.50 | 下載地址 | |
| NLPCC2014-SC | 中文 | ACC | 78.72 | 83.53 | 下載地址 | |
| 評價(jià)對象級(jí)的 情感分類 | Sem-L | 英文 | ACC | 81.35 | 81.62 | 下載地址 |
| Sem-R | 英文 | ACC | 87.89 | 88.36 | 下載地址 | |
| AI-challenge | 中文 | F1 | 72.87 | 72.90 | 暫未開放 | |
| SE-ABSA16_PHNS | 中文 | ACC | 79.58 | 82.91 | 下載地址 | |
| SE-ABSA16_CAME | 中文 | ACC | 87.11 | 90.06 | 下載地址 | |
| 觀點(diǎn) 抽取 | MPQA-H | 英文 | b-F1/p-F1 | 83.67/77.12 | 86.32/81.11 | 下載地址 |
| MPQA-T | 英文 | b-F1/p-F1 | 81.59/73.16 | 83.67/77.53 | 下載地址 | |
| COTE_BD | 中文 | F1 | 82.17 | 84.50 | 下載地址 | |
| COTE_MFW | 中文 | F1 | 86.18 | 87.90 | 下載地址 | |
| COTE_DP | 中文 | F1 | 84.33 | 86.30 | 下載地址 |
代碼結(jié)構(gòu)
.
├── README.md
├── requirements.txt
├── senta # senta核心代碼,包括模型、輸出reader、分詞方法等
├── script # 情感分析各任務(wù)入口啟動(dòng)腳本,通過調(diào)用配置文件完成模型的訓(xùn)練和預(yù)測
├── config # 任務(wù)配置文件目錄,在配置文件中設(shè)定模型的方法、超參數(shù)、數(shù)據(jù)等
一鍵化工具
為了降低用戶的使用門檻,百度在SKEP開源項(xiàng)目中集成了面向產(chǎn)業(yè)化的一鍵式情感分析預(yù)測工具。具體安裝和使用方法如下:
安裝方法
本倉庫支持pip安裝和源碼安裝兩種方式,使用pip或者源碼安裝時(shí)需要先安裝PaddlePaddle,PaddlePaddle安裝請參考安裝文檔。
pip安裝
python -m pip install Senta
源碼安裝
git clone https://github.com/baidu/Senta.git
cd Senta
python -m pip install .
使用方法
from senta import Senta
my_senta = Senta()
# 獲取目前支持的情感預(yù)訓(xùn)練模型, 我們開放了以ERNIE 1.0 large(中文)、ERNIE 2.0 large(英文)和RoBERTa large(英文)作為初始化的SKEP模型
print(my_senta.get_support_model()) # ["ernie_1.0_skep_large_ch", "ernie_2.0_skep_large_en", "roberta_skep_large_en"]
# 獲取目前支持的預(yù)測任務(wù)
print(my_senta.get_support_task()) # ["sentiment_classify", "aspect_sentiment_classify", "extraction"]
# 選擇是否使用gpu
use_cuda = True # 設(shè)置True or False
# 預(yù)測中文句子級(jí)情感分類任務(wù)
my_senta.init_model(model_class="ernie_1.0_skep_large_ch", task="sentiment_classify", use_cuda=use_cuda)
texts = ["中山大學(xué)是嶺南第一學(xué)府"]
result = my_senta.predict(texts)
print(result)
# 預(yù)測中文評價(jià)對象級(jí)的情感分類任務(wù)
my_senta.init_model(model_class="ernie_1.0_skep_large_ch", task="aspect_sentiment_classify", use_cuda=use_cuda)
texts = ["百度是一家高科技公司"]
aspects = ["百度"]
result = my_senta.predict(texts, aspects)
print(result)
# 預(yù)測中文觀點(diǎn)抽取任務(wù)
my_senta.init_model(model_class="ernie_1.0_skep_large_ch", task="extraction", use_cuda=use_cuda)
texts = ["唐 家 三 少 , 本 名 張 威 。"]
result = my_senta.predict(texts, aspects)
print(result)
# 預(yù)測英文句子級(jí)情感分類任務(wù)(基于SKEP-ERNIE2.0模型)
my_senta.init_model(model_class="ernie_2.0_skep_large_en", task="sentiment_classify", use_cuda=use_cuda)
texts = ["a sometimes tedious film ."]
result = my_senta.predict(texts)
print(result)
# 預(yù)測英文評價(jià)對象級(jí)的情感分類任務(wù)(基于SKEP-ERNIE2.0模型)
my_senta.init_model(model_class="ernie_2.0_skep_large_en", task="aspect_sentiment_classify", use_cuda=use_cuda)
texts = ["I love the operating system and the preloaded software."]
aspects = ["operating system"]
result = my_senta.predict(texts, aspects)
print(result)
# 預(yù)測英文觀點(diǎn)抽取任務(wù)(基于SKEP-ERNIE2.0模型)
my_senta.init_model(model_class="ernie_2.0_skep_large_en", task="extraction", use_cuda=use_cuda)
texts = ["The JCC would be very pleased to welcome your organization as a corporate sponsor ."]
result = my_senta.predict(texts)
print(result)
# 預(yù)測英文句子級(jí)情感分類任務(wù)(基于SKEP-RoBERTa模型)
my_senta.init_model(model_class="roberta_skep_large_en", task="sentiment_classify", use_cuda=use_cuda)
texts = ["a sometimes tedious film ."]
result = my_senta.predict(texts)
print(result)
# 預(yù)測英文評價(jià)對象級(jí)的情感分類任務(wù)(基于SKEP-RoBERTa模型)
my_senta.init_model(model_class="roberta_skep_large_en", task="aspect_sentiment_classify", use_cuda=use_cuda)
texts = ["I love the operating system and the preloaded software."]
aspects = ["operating system"]
result = my_senta.predict(texts, aspects)
print(result)
# 預(yù)測英文觀點(diǎn)抽取任務(wù)(基于SKEP-RoBERTa模型)
my_senta.init_model(model_class="roberta_skep_large_en", task="extraction", use_cuda=use_cuda)
texts = ["The JCC would be very pleased to welcome your organization as a corporate sponsor ."]
result = my_senta.predict(texts)
print(result)
詳細(xì)使用說明
項(xiàng)目下載
代碼下載
下載代碼庫到本地
git clone https://github.com/baidu/Senta.git
模型下載
下載情感分析預(yù)訓(xùn)練SKEP的中文模型和英文模型(本項(xiàng)目中開放了以ERNIE 1.0 large(中文)、ERNIE 2.0 large(英文)和RoBERTa large(英文)作為初始化,訓(xùn)練的中英文情感預(yù)訓(xùn)練模型)
cd ./model_files
# 以ERNIE 1.0 large(中文)作為初始化,訓(xùn)練的SKEP中文情感預(yù)訓(xùn)練模型(簡寫為SKEP-ERNIE1.0)
sh download_ernie_1.0_skep_large_ch.sh
# 以ERNIE 2.0 large(英文)作為初始化,訓(xùn)練的SKEP英文情感預(yù)訓(xùn)練模型(簡寫為SKEP-ERNIE2.0)
sh download_ernie_2.0_skep_large_en.sh
# 以RoBERTa large(英文)作為初始化,訓(xùn)練的SKEP英文情感預(yù)訓(xùn)練模型(簡寫為SKEP-RoBERTa)
sh download_roberta_skep_large_en.shdemo數(shù)據(jù)下載
下載demo數(shù)據(jù)用作SKEP訓(xùn)練和情感分析任務(wù)訓(xùn)練
cd ./data/
sh download_ch_data.sh # 中文測試數(shù)據(jù)
sh download_en_data.sh # 英文測試數(shù)據(jù)
環(huán)境安裝
PaddlePaddle 安裝
本項(xiàng)目依賴于 PaddlePaddle 1.6.3,PaddlePaddle安裝后,需要及時(shí)的將 CUDA、cuDNN、NCCL2 等動(dòng)態(tài)庫路徑加入到環(huán)境變量 LD_LIBRARY_PATH 之中,否則訓(xùn)練過程中會(huì)報(bào)相關(guān)的庫錯(cuò)誤。具體的paddlepaddle配置細(xì)節(jié)請查閱這里?安裝文檔。
推薦使用pip安裝方式
python -m pip install paddlepaddle-gpu==1.6.3.post107 -i https://mirror.baidu.com/pypi/simple
senta項(xiàng)目python包依賴
支持Python 3 的版本要求 3.7;項(xiàng)目中其他python包依賴列在根目錄下的requirements.txt文件中,使用以下命令安裝:
python -m pip install -r requirements.txt
環(huán)境變量添加
在./env.sh中修改環(huán)境變量,包括python、CUDA、cuDNN、NCCL2、PaddlePaddle相關(guān)環(huán)境變量,PaddlePaddle環(huán)境變量說明請參考?PaddlePaddle環(huán)境變量說明
模型訓(xùn)練和預(yù)測
Pre-train訓(xùn)練
# 在SKEP-ERNIE1.0中文模型的基礎(chǔ)上,繼續(xù)pre-train
sh ./script/run_pretrain_ernie_1.0_skep_large_ch.sh
# 在SKEP-ERNIE2.0英文模型的基礎(chǔ)上,繼續(xù)pre-train
sh ./script/run_pretrain_ernie_2.0_skep_large_en.sh
# 在SKEP-RoBERTa英文模型的基礎(chǔ)上,繼續(xù)pre-train
sh ./script/run_pretrain_roberta_skep_large_en.shFinetune訓(xùn)練和預(yù)測句子級(jí)情感分類任務(wù)
# 基于SEKP-ERNIE1.0模型finetune訓(xùn)練和預(yù)測中文句子級(jí)情感分類任務(wù),示例數(shù)據(jù):ChnSentiCorp
sh ./script/run_train.sh ./config/ernie_1.0_skep_large_ch.Chnsenticorp.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/ernie_1.0_skep_large_ch.Chnsenticorp.infer.json # 預(yù)測# 基于SKEP-ERNIE2.0模型finetune訓(xùn)練和預(yù)測英文句子級(jí)情感分類任務(wù),示例數(shù)據(jù):SST-2
sh ./script/run_train.sh ./config/ernie_2.0_skep_large_en.SST-2.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/ernie_2.0_skep_large_en.SST-2.infer.json # 預(yù)測# 基于SKEP-RoBERTa模型finetune訓(xùn)練和預(yù)測英文句子級(jí)情感分類任務(wù),示例數(shù)據(jù):SST-2
sh ./script/run_train.sh ./config/roberta_skep_large_en.SST-2.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/roberta_skep_large_en.SST-2.infer.json # 預(yù)測Finetune訓(xùn)練和預(yù)測評價(jià)對象級(jí)的情感分類任務(wù)
# 基于SKEP-ERNIE1.0模型finetune訓(xùn)練和預(yù)測中文評價(jià)對象級(jí)的情感分類任務(wù),示例數(shù)據(jù):SE-ABSA 16_PHNS
sh ./script/run_train.sh ./config/ernie_1.0_skep_large_ch.SE-ABSA16_PHNS.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/ernie_1.0_skep_large_ch.SE-ABSA16_PHNS.infer.json # 預(yù)測# 基于SEKP-ERNIE2.0模型finetune訓(xùn)練和預(yù)測英文評價(jià)對象級(jí)的情感分類任務(wù),示例數(shù)據(jù):Sem-L
sh ./script/run_train.sh ./config/ernie_2.0_skep_large_en.absa_laptops.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/ernie_2.0_skep_large_en.absa_laptops.infer.json # 預(yù)測# 基于SKEP-RoBERTa模型finetune訓(xùn)練和預(yù)測英文評價(jià)對象級(jí)的情感分類任務(wù),示例數(shù)據(jù):Sem-L
sh ./script/run_train.sh ./config/roberta_skep_large_en.absa_laptops.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/roberta_skep_large_en.absa_laptops.infer.json # 預(yù)測Finetune訓(xùn)練和預(yù)測觀點(diǎn)抽取或標(biāo)注任務(wù)
# 基于SKEP-ERNIE1.0模型finetune訓(xùn)練和預(yù)測中文觀點(diǎn)抽取任務(wù),示例數(shù)據(jù):COTE_BD
sh ./script/run_train.sh ./config/ernie_1.0_skep_large_ch.COTE_BD.oe.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/ernie_1.0_skep_large_ch.COTE_BD.infer.json # 預(yù)測# 基于SKEP-ERNIE2.0模型finetune訓(xùn)練和預(yù)測英文觀點(diǎn)抽取任務(wù),示例數(shù)據(jù):MPQA
sh ./script/run_train.sh ./config/ernie_2.0_skep_large_en.MPQA.orl.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/ernie_2.0_skep_large_en.MPQA.infer.json # 預(yù)測# 基于SKEP-RoBERTa模型finetune訓(xùn)練和預(yù)測英文觀點(diǎn)抽取任務(wù),示例數(shù)據(jù):MPQA
sh ./script/run_train.sh ./config/roberta_skep_large_en.MPQA.orl.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/roberta_skep_large_en.MPQA.infer.json # 預(yù)測該代碼同時(shí)支持用戶進(jìn)一步開發(fā)使用,可以根據(jù)配置文件中設(shè)置相關(guān)數(shù)據(jù)、模型、優(yōu)化器,以及修改模型的超參數(shù)進(jìn)行二次開發(fā)訓(xùn)練。
本代碼庫目前僅支持基于SKEP情感預(yù)訓(xùn)練模型進(jìn)行訓(xùn)練和預(yù)測,如果用戶希望使用Bow、CNN、LSTM等輕量級(jí)模型,請移步至Senta v1使用。
Demo數(shù)據(jù)集說明
該項(xiàng)目中使用的各數(shù)據(jù)集的說明、下載方法及使用樣例如下:
句子級(jí)情感分類數(shù)據(jù)集
ChnSentiCorp是中文句子級(jí)情感分類數(shù)據(jù)集,包含酒店、筆記本電腦和書籍的網(wǎng)購評論。為方便使用demo數(shù)據(jù)中提供了完整數(shù)據(jù),數(shù)據(jù)示例:
qid label text_a
0 1 這間酒店環(huán)境和服務(wù)態(tài)度亦算不錯(cuò),但房間空間太小~~不宣容納太大件行李~~且房間格調(diào)還可以~~ 中餐廳的廣東點(diǎn)心不太好吃~~要改善之~~~~但算價(jià)錢平宜~~可接受~~ 西餐廳格調(diào)都很好~~但吃的味道一般且令人等得太耐了~~要改善之~~
1 <薦書> 推薦所有喜歡<紅樓>的紅迷們一定要收藏這本書,要知道當(dāng)年我聽說這本書的時(shí)候花很長時(shí)間去圖書館找和借都沒能如愿,所以這次一看到當(dāng)當(dāng)有,馬上買了,紅迷們也要記得備貨哦!
2 0 商品的不足暫時(shí)還沒發(fā)現(xiàn),京東的訂單處理速度實(shí)在.......周二就打包完成,周五才發(fā)貨...
...SST-2是英文句子情感分類數(shù)據(jù)集,主要由電影評論構(gòu)成。為方便使用demo數(shù)據(jù)中提供了完整數(shù)據(jù),數(shù)據(jù)集下載地址,數(shù)據(jù)示例:
qid label text_a
0 1 it 's a charming and often affecting journey .
1 0 unflinchingly bleak and desperate
2 1 allows us to hope that nolan is poised to embark a major career as a commercial yet inventive filmmaker .
...評價(jià)對象級(jí)情感分類數(shù)據(jù)集
SE-ABSA16_PHNS是中文評價(jià)對象級(jí)情感分類數(shù)據(jù)集,主要由描述手機(jī)類別某個(gè)屬性的商品用戶評論構(gòu)成。為方便使用demo數(shù)據(jù)中提供了完整數(shù)據(jù),數(shù)據(jù)集下載地址,數(shù)據(jù)集示例如下:
qid label text_a text_b
0 1 software#usability 剛剛?cè)胧?600,體會(huì)。剛剛從淘寶購買,1635元(包郵)。1、全新,應(yīng)該是歐版機(jī),配件也是正品全新。2、在三星官網(wǎng)下載了KIES,可用免費(fèi)軟件非常多,絕對夠用。3、不到2000元能買到此種手機(jī),知足了。
1 1 display#quality mk16i用后的體驗(yàn)感覺不錯(cuò),就是有點(diǎn)厚,屏幕分辨率高,運(yùn)行流暢,就是不知道能不能刷4.0的系統(tǒng)啊
2 1 phone#operation_performance mk16i用后的體驗(yàn)感覺不錯(cuò),就是有點(diǎn)厚,屏幕分辨率高,運(yùn)行流暢,就是不知道能不能刷4.0的系統(tǒng)啊
...Sem-L數(shù)據(jù)集是英文評價(jià)對象級(jí)情感分類數(shù)據(jù)集,主要由描述筆記本電腦類別某個(gè)屬性的商品用戶評論構(gòu)成。為方便使用demo數(shù)據(jù)中提供了完整數(shù)據(jù),數(shù)據(jù)集下載地址,數(shù)據(jù)集示例如下:
qid text_a text_b label
0 Boot time Boot time is super fast, around anywhere from 35 seconds to 1 minute. 0
1 tech support tech support would not fix the problem unless I bought your plan for $150 plus. 1
2 Set up Set up was easy. 0
3 Windows 8 Did not enjoy the new Windows 8 and touchscreen functions. 1
...觀點(diǎn)抽取抽取數(shù)據(jù)集
COTE-BD數(shù)據(jù)集是中文互聯(lián)網(wǎng)評論數(shù)據(jù)集。為方便使用demo數(shù)據(jù)中提供了完整數(shù)據(jù),數(shù)據(jù)集下載地址,數(shù)據(jù)集使用例子如下,其中為了方便模型使用,下面數(shù)據(jù)是將文本進(jìn)行分詞處理后結(jié)果,標(biāo)簽用BIO標(biāo)記評論實(shí)體或者事件。
...
B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O 張 莉 , 女 , 祖 籍 四 川 , 1982 年 考 入 西 安 美 術(shù) 學(xué) 院 工 藝 系 , 1986 留 校 任 教 至 今 。
O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O 可 能 本 片 確 實(shí) 應(yīng) 該 在 電 影 院 看 3d , 才 能 體 會(huì) 到 奧 斯 卡 對 其 那 么 多 技 術(shù) 的 表 揚(yáng) , 也 才 能 體 會(huì) 到 馬 丁 想 用 技 術(shù) 的 進(jìn) 步 對 老 電 影 致 敬 的 用 意 [UNK] 最 近 聽 說 《 雨 果 》 五 月 國 內(nèi) 排 片 , 想 說 :廣 電 搞 毛 啊 !。
O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O 《 笑 忘 書 》 是 由 林 夕 作 詞 , c . y . kong 作 曲 , 王 菲 演 唱 的 一 首 歌 , 收 錄 于 專 輯 《 寓 言 》 中 。
B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O 龍 泉 寺 中 精 致 的 壁 畫 , 近 前 觀 看 每 位 人 物 面 部 表 情 都 表 現(xiàn) 得 栩 栩 如 生 , 文 革 中 部 分 被 損 壞 后 來 修 復(fù) 。
...MPQA數(shù)據(jù)集是英文互聯(lián)網(wǎng)評論數(shù)據(jù)集。為方便使用demo數(shù)據(jù)中提供了完整數(shù)據(jù),數(shù)據(jù)集下載地址,數(shù)據(jù)集使用例子如下,其中為了方便模型使用需要將文本進(jìn)行分詞處理,標(biāo)簽用BIO標(biāo)記評論內(nèi)容、評論實(shí)體和實(shí)體內(nèi)容表達(dá)主體。
...
O O O B_H B_DS B_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T O O O O O In most cases he described the legal punishments like floggings and executions of murderers and major drug traffickers that are applied based on the Shria , or Islamic law as human rights violations .
O O O O B_H B_DS I_DS I_DS I_DS I_DS B_T O O O O O O O In other cases , he made unfounded charges by accusing Iran of discrimination against women and minorities .
B_H B_DS I_DS I_DS O O O O O O O O O O O O O O O O O O O O He made such charges despite the fact that women 's political , social and cultural participation is not less than that of men .
O O O B_H B_DS O O O O O B_T I_T I_T I_T I_T I_T I_T I_T I_T O O O O O O O O O O O O O For instance , he denounced as a human rights violation the banning and seizure of satellite dishes in Iran , while the measure has been taken in line with the law .
...
論文效果復(fù)現(xiàn)
基于該項(xiàng)目可以實(shí)現(xiàn)對于論文 Sentiment Knowledge Enhanced Pre-training for Sentiment Analysis 效果的復(fù)現(xiàn)。下面給出論文效果的復(fù)現(xiàn)方法示例:
#下載以Roberta作為初始化,訓(xùn)練的SKEP英文情感預(yù)訓(xùn)練模型(簡寫為SKEP-RoBERTa)
sh download_roberta_skep_large_en.sh
#基于SKEP-RoBERTa模型finetune訓(xùn)練和預(yù)測英文句子級(jí)情感分類任務(wù)(示例數(shù)據(jù):SST-2)
sh ./script/run_train.sh ./config/roberta_skep_large_en.SST-2.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/roberta_skep_large_en.SST-2.infer.json # 預(yù)測
#基于SKEP-RoBERTa模型finetune訓(xùn)練和預(yù)測英文評價(jià)對象級(jí)的情感分類任務(wù)(示例數(shù)據(jù):Sem-L)
sh ./script/run_train.sh ./config/roberta_skep_large_en.absa_laptops.cls.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/roberta_skep_large_en.absa_laptops.infer.json # 預(yù)測
#基于SKEP-RoBERTa模型finetune訓(xùn)練和預(yù)測英文觀點(diǎn)抽取任務(wù)(示例數(shù)據(jù):MPQA)
sh ./script/run_train.sh ./config/roberta_skep_large_en.MPQA.orl.json # finetune訓(xùn)練
sh ./script/run_infer.sh ./config/roberta_skep_large_en.MPQA.infer.json # 預(yù)測
注:如需要復(fù)現(xiàn)論文數(shù)據(jù)集結(jié)果,請參考論文修改對應(yīng)任務(wù)的參數(shù)設(shè)置。
文獻(xiàn)引用
如需使用該項(xiàng)目中的代碼、模型或是方法,請?jiān)谙嚓P(guān)文檔、論文中引用我們的工作。
@inproceedings{tian-etal-2020-skep,
title = "{SKEP}: Sentiment Knowledge Enhanced Pre-training for Sentiment Analysis",
author = "Tian, Hao and
Gao, Can and
Xiao, Xinyan and
Liu, Hao and
He, Bolei and
Wu, Hua and
Wang, Haifeng and
wu, feng",
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
month = jul,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2020.acl-main.374",
pages = "4067--4076",
abstract = "Recently, sentiment analysis has seen remarkable advance with the help of pre-training approaches. However, sentiment knowledge, such as sentiment words and aspect-sentiment pairs, is ignored in the process of pre-training, despite the fact that they are widely used in traditional sentiment analysis approaches. In this paper, we introduce Sentiment Knowledge Enhanced Pre-training (SKEP) in order to learn a unified sentiment representation for multiple sentiment analysis tasks. With the help of automatically-mined knowledge, SKEP conducts sentiment masking and constructs three sentiment knowledge prediction objectives, so as to embed sentiment information at the word, polarity and aspect level into pre-trained sentiment representation. In particular, the prediction of aspect-sentiment pairs is converted into multi-label classification, aiming to capture the dependency between words in a pair. Experiments on three kinds of sentiment tasks show that SKEP significantly outperforms strong pre-training baseline, and achieves new state-of-the-art results on most of the test datasets. We release our code at https://github.com/baidu/Senta.",
}

感謝點(diǎn)贊支持下哈?
