1 Star 0 Fork 252

jack / Senta

forked from 百度开源 / Senta 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

English|简体中文

Senta

目录

简介

情感分析旨在自动识别和提取文本中的倾向、立场、评价、观点等主观信息。它包含各式各样的任务,比如句子级情感分类、评价对象级情感分类、观点抽取、情绪分类等。情感分析是人工智能的重要研究方向,具有很高的学术价值。同时,情感分析在消费决策、舆情分析、个性化推荐等领域均有重要的应用,具有很高的商业价值。

近日,百度正式发布情感预训练模型SKEP(Sentiment Knowledge Enhanced Pre-training for Sentiment Analysis)。SKEP利用情感知识增强预训练模型, 在14项中英情感分析典型任务上全面超越SOTA,此工作已经被ACL 2020录用。

论文地址:https://arxiv.org/abs/2005.05635

为了方便研发人员和商业合作伙伴共享效果领先的情感分析技术,本次百度在Senta中开源了基于SKEP的情感预训练代码和中英情感预训练模型。而且,为了进一步降低用户的使用门槛,百度在SKEP开源项目中集成了面向产业化的一键式情感分析预测工具。用户只需要几行代码即可实现基于SKEP的情感预训练以及模型预测功能。

SKEP

SKEP是百度研究团队提出的基于情感知识增强的情感预训练算法,此算法采用无监督方法自动挖掘情感知识,然后利用情感知识构建预训练目标,从而让机器学会理解情感语义。SKEP为各类情感分析任务提供统一且强大的情感语义表示。

百度研究团队在三个典型情感分析任务,句子级情感分类(Sentence-level Sentiment Classification),评价对象级情感分类(Aspect-level Sentiment Classification)、观点抽取(Opinion Role Labeling),共计14个中英文数据上进一步验证了情感预训练模型SKEP的效果。实验表明,以通用预训练模型ERNIE(内部版本)作为初始化,SKEP相比ERNIE平均提升约1.2%,并且较原SOTA平均提升约2%,具体效果如下表:

任务 数据集合 语言 指标 原SOTA SKEP 数据集地址
句子级情感
分类
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 下载地址
评价对象级的
情感分类
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 下载地址
观点
抽取
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 下载地址

代码结构

.
├── README.md
├── requirements.txt
├── senta                    # senta核心代码,包括模型、输出reader、分词方法等
├── script                   # 情感分析各任务入口启动脚本,通过调用配置文件完成模型的训练和预测
├── config                   # 任务配置文件目录,在配置文件中设定模型的方法、超参数、数据等

一键化工具

为了降低用户的使用门槛,百度在SKEP开源项目中集成了面向产业化的一键式情感分析预测工具。具体安装和使用方法如下:

安装方法

本仓库支持pip安装和源码安装两种方式,使用pip或者源码安装时需要先安装PaddlePaddle,PaddlePaddle安装请参考安装文档

  1. pip安装
python -m pip install Senta
  1. 源码安装
git clone https://github.com/baidu/Senta.git
cd Senta
python -m pip install .

使用方法

from senta import Senta

my_senta = Senta()

# 获取目前支持的情感预训练模型, 我们开放了以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"]

# 获取目前支持的预测任务
print(my_senta.get_support_task()) # ["sentiment_classify", "aspect_sentiment_classify", "extraction"]

# 选择是否使用gpu
use_cuda = True # 设置True or False

# 预测中文句子级情感分类任务
my_senta.init_model(model_class="ernie_1.0_skep_large_ch", task="sentiment_classify", use_cuda=use_cuda)
texts = ["中山大学是岭南第一学府"]
result = my_senta.predict(texts)
print(result)

# 预测中文评价对象级的情感分类任务
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)

# 预测中文观点抽取任务
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)

# 预测英文句子级情感分类任务(基于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)

# 预测英文评价对象级的情感分类任务(基于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)

# 预测英文观点抽取任务(基于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)

# 预测英文句子级情感分类任务(基于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)

# 预测英文评价对象级的情感分类任务(基于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)

# 预测英文观点抽取任务(基于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)

详细使用说明

项目下载

  1. 代码下载

    下载代码库到本地

    git clone https://github.com/baidu/Senta.git
  2. 模型下载

    下载情感分析预训练SKEP的中文模型和英文模型(本项目中开放了以ERNIE 1.0 large(中文)ERNIE 2.0 large(英文)RoBERTa large(英文)作为初始化,训练的中英文情感预训练模型)

    cd ./model_files
    
    # 以ERNIE 1.0 large(中文)作为初始化,训练的SKEP中文情感预训练模型(简写为SKEP-ERNIE1.0)
    sh download_ernie_1.0_skep_large_ch.sh
    
    # 以ERNIE 2.0 large(英文)作为初始化,训练的SKEP英文情感预训练模型(简写为SKEP-ERNIE2.0)
    sh download_ernie_2.0_skep_large_en.sh
    
    # 以RoBERTa large(英文)作为初始化,训练的SKEP英文情感预训练模型(简写为SKEP-RoBERTa)
    sh download_roberta_skep_large_en.sh
  3. demo数据下载

    下载demo数据用作SKEP训练和情感分析任务训练

    cd ./data/
    sh download_ch_data.sh # 中文测试数据
    sh download_en_data.sh # 英文测试数据

环境安装

  1. PaddlePaddle 安装

    本项目依赖于 PaddlePaddle 1.6.3,PaddlePaddle安装后,需要及时的将 CUDA、cuDNN、NCCL2 等动态库路径加入到环境变量 LD_LIBRARY_PATH 之中,否则训练过程中会报相关的库错误。具体的paddlepaddle配置细节请查阅这里 安装文档

    推荐使用pip安装方式

    python -m pip install paddlepaddle-gpu==1.6.3.post107 -i https://mirror.baidu.com/pypi/simple
  2. senta项目python包依赖

    支持Python 3 的版本要求 3.7; 项目中其他python包依赖列在根目录下的requirements.txt文件中,使用以下命令安装:

    python -m pip install -r requirements.txt
  3. 环境变量添加

    在./env.sh中修改环境变量,包括python、CUDA、cuDNN、NCCL2、PaddlePaddle相关环境变量,PaddlePaddle环境变量说明请参考 PaddlePaddle环境变量说明

模型训练和预测

  1. Pre-train训练

    #  在SKEP-ERNIE1.0中文模型的基础上,继续pre-train
    sh ./script/run_pretrain_ernie_1.0_skep_large_ch.sh
    
    # 在SKEP-ERNIE2.0英文模型的基础上,继续pre-train
    sh ./script/run_pretrain_ernie_2.0_skep_large_en.sh
    
    # 在SKEP-RoBERTa英文模型的基础上,继续pre-train
    sh ./script/run_pretrain_roberta_skep_large_en.sh
  2. Finetune训练和预测句子级情感分类任务

    # 基于SEKP-ERNIE1.0模型finetune训练和预测中文句子级情感分类任务,示例数据:ChnSentiCorp
    sh ./script/run_train.sh ./config/ernie_1.0_skep_large_ch.Chnsenticorp.cls.json # finetune训练
    sh ./script/run_infer.sh ./config/ernie_1.0_skep_large_ch.Chnsenticorp.infer.json # 预测
    # 基于SKEP-ERNIE2.0模型finetune训练和预测英文句子级情感分类任务,示例数据:SST-2
    sh ./script/run_train.sh ./config/ernie_2.0_skep_large_en.SST-2.cls.json # finetune训练
    sh ./script/run_infer.sh ./config/ernie_2.0_skep_large_en.SST-2.infer.json # 预测
    # 基于SKEP-RoBERTa模型finetune训练和预测英文句子级情感分类任务,示例数据:SST-2
    sh ./script/run_train.sh ./config/roberta_skep_large_en.SST-2.cls.json # finetune训练
    sh ./script/run_infer.sh ./config/roberta_skep_large_en.SST-2.infer.json # 预测
  3. Finetune训练和预测评价对象级的情感分类任务

    # 基于SKEP-ERNIE1.0模型finetune训练和预测中文评价对象级的情感分类任务,示例数据:SE-ABSA 16_PHNS
    sh ./script/run_train.sh ./config/ernie_1.0_skep_large_ch.SE-ABSA16_PHNS.cls.json # finetune训练
    sh ./script/run_infer.sh ./config/ernie_1.0_skep_large_ch.SE-ABSA16_PHNS.infer.json # 预测
    # 基于SEKP-ERNIE2.0模型finetune训练和预测英文评价对象级的情感分类任务,示例数据:Sem-L
    sh ./script/run_train.sh ./config/ernie_2.0_skep_large_en.absa_laptops.cls.json # finetune训练
    sh ./script/run_infer.sh ./config/ernie_2.0_skep_large_en.absa_laptops.infer.json # 预测
    # 基于SKEP-RoBERTa模型finetune训练和预测英文评价对象级的情感分类任务,示例数据:Sem-L
    sh ./script/run_train.sh ./config/roberta_skep_large_en.absa_laptops.cls.json # finetune训练
    sh ./script/run_infer.sh ./config/roberta_skep_large_en.absa_laptops.infer.json # 预测
  4. Finetune训练和预测观点抽取或标注任务

    # 基于SKEP-ERNIE1.0模型finetune训练和预测中文观点抽取任务,示例数据:COTE_BD
    sh ./script/run_train.sh ./config/ernie_1.0_skep_large_ch.COTE_BD.oe.json # finetune训练
    sh ./script/run_infer.sh ./config/ernie_1.0_skep_large_ch.COTE_BD.infer.json # 预测
    # 基于SKEP-ERNIE2.0模型finetune训练和预测英文观点抽取任务,示例数据:MPQA 
    sh ./script/run_train.sh ./config/ernie_2.0_skep_large_en.MPQA.orl.json # finetune训练
    sh ./script/run_infer.sh ./config/ernie_2.0_skep_large_en.MPQA.infer.json # 预测
    # 基于SKEP-RoBERTa模型finetune训练和预测英文观点抽取任务,示例数据:MPQA
    sh ./script/run_train.sh ./config/roberta_skep_large_en.MPQA.orl.json # finetune训练
    sh ./script/run_infer.sh ./config/roberta_skep_large_en.MPQA.infer.json # 预测
  5. 该代码同时支持用户进一步开发使用,可以根据配置文件中设置相关数据、模型、优化器,以及修改模型的超参数进行二次开发训练。

  6. 本代码库目前仅支持基于SKEP情感预训练模型进行训练和预测,如果用户希望使用Bow、CNN、LSTM等轻量级模型,请移步至Senta v1使用。

Demo数据集说明

该项目中使用的各数据集的说明、下载方法及使用样例如下:

  1. 句子级情感分类数据集

    ChnSentiCorp是中文句子级情感分类数据集,包含酒店、笔记本电脑和书籍的网购评论。为方便使用demo数据中提供了完整数据,数据示例:

     qid	label	text_a
     0	1	這間酒店環境和服務態度亦算不錯,但房間空間太小~~不宣容納太大件行李~~且房間格調還可以~~ 中餐廳的廣東點心不太好吃~~要改善之~~~~但算價錢平宜~~可接受~~ 西餐廳格調都很好~~但吃的味道一般且令人等得太耐了~~要改善之~~
     1	<荐书> 推荐所有喜欢<红楼>的红迷们一定要收藏这本书,要知道当年我听说这本书的时候花很长时间去图书馆找和借都没能如愿,所以这次一看到当当有,马上买了,红迷们也要记得备货哦!
     2	0	商品的不足暂时还没发现,京东的订单处理速度实在.......周二就打包完成,周五才发货...
     ...

    SST-2是英文句子情感分类数据集,主要由电影评论构成。为方便使用demo数据中提供了完整数据,数据集下载地址,数据示例:

    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 .
    ...
  2. 评价对象级情感分类数据集

    SE-ABSA16_PHNS是中文评价对象级情感分类数据集,主要由描述手机类别某个属性的商品用户评论构成。为方便使用demo数据中提供了完整数据,数据集下载地址,数据集示例如下:

    qid	label	text_a	text_b
    0	1	software#usability	刚刚入手8600,体会。刚刚从淘宝购买,1635元(包邮)。1、全新,应该是欧版机,配件也是正品全新。2、在三星官网下载了KIES,可用免费软件非常多,绝对够用。3、不到2000元能买到此种手机,知足了。
    1	1	display#quality	mk16i用后的体验感觉不错,就是有点厚,屏幕分辨率高,运行流畅,就是不知道能不能刷4.0的系统啊
    2	1	phone#operation_performance	mk16i用后的体验感觉不错,就是有点厚,屏幕分辨率高,运行流畅,就是不知道能不能刷4.0的系统啊
    ...

    Sem-L数据集是英文评价对象级情感分类数据集,主要由描述笔记本电脑类别某个属性的商品用户评论构成。为方便使用demo数据中提供了完整数据,数据集下载地址,数据集示例如下:

    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
    ...
  3. 观点抽取抽取数据集

    COTE-BD数据集是中文互联网评论数据集。为方便使用demo数据中提供了完整数据,数据集下载地址,数据集使用例子如下,其中为了方便模型使用,下面数据是将文本进行分词处理后结果,标签用BIO标记评论实体或者事件。

    ...
    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 年 考 入 西 安 美 术 学 院 工 艺 系 , 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	可 能 本 片 确 实 应 该 在 电 影 院 看 3d , 才 能 体 会 到 奥 斯 卡 对 其 那 么 多 技 术 的 表 扬 , 也 才 能 体 会 到 马 丁 想 用 技 术 的 进 步 对 老 电 影 致 敬 的 用 意 [UNK] 最 近 听 说 《 雨 果 》 五 月 国 内 排 片 , 想 说 : 广 电 搞 毛 啊 ! 。
    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	龙 泉 寺 中 精 致 的 壁 画 , 近 前 观 看 每 位 人 物 面 部 表 情 都 表 现 得 栩 栩 如 生 , 文 革 中 部 分 被 损 坏 后 来 修 复 。
    ...

    MPQA数据集是英文互联网评论数据集。为方便使用demo数据中提供了完整数据,数据集下载地址,数据集使用例子如下,其中为了方便模型使用需要将文本进行分词处理,标签用BIO标记评论内容、评论实体和实体内容表达主体。

    ...
    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 .
    ...

论文效果复现

基于该项目可以实现对于论文 Sentiment Knowledge Enhanced Pre-training for Sentiment Analysis 效果的复现。下面给出论文效果的复现方法示例:

#下载以Roberta作为初始化,训练的SKEP英文情感预训练模型(简写为SKEP-RoBERTa)
sh download_roberta_skep_large_en.sh

#基于SKEP-RoBERTa模型finetune训练和预测英文句子级情感分类任务(示例数据:SST-2)
sh ./script/run_train.sh ./config/roberta_skep_large_en.SST-2.cls.json # finetune训练
sh ./script/run_infer.sh ./config/roberta_skep_large_en.SST-2.infer.json # 预测

#基于SKEP-RoBERTa模型finetune训练和预测英文评价对象级的情感分类任务(示例数据:Sem-L)
sh ./script/run_train.sh ./config/roberta_skep_large_en.absa_laptops.cls.json # finetune训练
sh ./script/run_infer.sh ./config/roberta_skep_large_en.absa_laptops.infer.json # 预测

#基于SKEP-RoBERTa模型finetune训练和预测英文观点抽取任务(示例数据:MPQA)
sh ./script/run_train.sh ./config/roberta_skep_large_en.MPQA.orl.json # finetune训练
sh ./script/run_infer.sh ./config/roberta_skep_large_en.MPQA.infer.json # 预测

注:如需要复现论文数据集结果,请参考论文修改对应任务的参数设置。

文献引用

如需使用该项目中的代码、模型或是方法,请在相关文档、论文中引用我们的工作。

@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.",
}
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

百度开源的情感分析系统 展开 收起
Python
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/weixingongzhong/Senta.git
git@gitee.com:weixingongzhong/Senta.git
weixingongzhong
Senta
Senta
master

搜索帮助

14c37bed 8189591 565d56ea 8189591