Giter Club home page Giter Club logo

jd-comments-sentiment-analysis's Introduction

京东商品评论情感分析

爬取京东商城中指定商品下的用户评论,对数据预处理后基于SnowNLP的sentiment模块对文本进行情感分析。

运行环境

  • Mac OS X 兼容更低版本
  • Python3.7 requirements.txt
  • Pycharm

运行方法

数据爬取(jd.comment.py)

  1. 启动jd_comment.py,建议修改jd_comment.py中变量user-agent为自己浏览器用户代理
  2. 输入京东商品完整URL
  3. 得到京东评论词云,存放于jd_ciyun.jpg(词云轮廓形状存放于jdicon.jpg)
  4. 得到京东评论数据,存放于jd_comment.csv

模型训练(train.py

  1. 准备正负语料集online_shopping_10_cats.csv,分别存入negative.txt和positive.txt
  2. 启动train.py,新建文件sentiment.marshal,存入训练后的模型
  3. 找到外部库中snownlp中sentiment模块,将训练得到的sentiment.marshal.3文件覆盖sentiment模块中自带的sentiment.marshal.3

情感分析(sentiment.analysis.py

  1. 启动sentiment.analysis.py
  2. 开始对jd_comment.csv中评论进行数据处理,处理后文件存入processed_comment_data.csv
  3. sentiment模块根据sentiment.marshal.3对评论进行情感评分,评分结果存入result.csv
  4. 评分结果可视化,生成文件fig.png

  • 词云轮廓图

* 商品评论词云

* 情感分析结果可视化

jd-comments-sentiment-analysis's People

Contributors

da1ooo avatar edcqiqi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.