应用场景
- 从商品详情页爬取商品评论,对其做舆情分析;
- 电话客服,对音频进行分析,做舆情分析;
- 通过对商品的评论分析,作为对供应商打分/商品个性化排序等依据;
模型选用
- 文本,选用了通义实验室fine-tune的structBERT 模型,基于大众点评的评论数据进行训练,使用预训练模型进行推理,CPU 能跑,支持模型微调,基本上不用微调了,因为他是基于电商领域的数据集进行训练的,基本够用,training dataset 使用了大众点评等平台数据,可本地部署;
参考论文:
title: Incorporating language structures into pre-training for deep language understanding
author:Wang, Wei and Bi, Bin and Yan, Ming and Wu, Chen and Bao, Zuyi and Xia, Jiangnan and Peng, Liwei and Si, Luo
journal:arXiv preprint arXiv:1908.04577,
year:2019
版本依赖:
modelscope-lib 最新版本
推理代码:
semantic_cls = pipeline(Tasks.text_classification, 'damo/nlp_structbert_sentiment-classification_chinese-base')
comment0 = '非常厚实的一包大米,来自遥远的东北,盘锦大米,应该不错的,密封性很好。卖家的服务真是贴心周到!他们提供了专业的建议,帮助我选择了合适的商品。物流速度也很快,让我顺利收到了商品。'
result0 = semantic_cls(input=comment0)
if result0['scores'][0] > result0['scores'][1]:
print("'" + comment0 + "',属于" + result0["labels"][0] + "评价")
else:
print("'&