Skip to content

lutingwei27/SentimentAnalysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentiment Analyzer

Goal

建立完整的商品評論情感分析系統,讓使用者能夠:

  • 自動收集電商平台的商品評論
  • 進行中文評價的情感分析(正面/負面/中性)
  • 提供詳細的視覺化分析報告
  • 為商家提供有價值的報告

Tech Used & Structures

Core

  • Python 3.8+
  • pandas & numpy
  • scikit-learn
  • jieba
  • matplotlib & seaborn
  • beautifulsoup4

模組化設計

src/
├── data_collector.py      # 資料收集
├── sentiment_analyzer.py  # 情感分析
├── visualizer.py         # 視覺化
└── utils.py              

專案結構

sentiment-analysis/
├── data/                 # 資料
│   ├── raw/             
│   ├── processed/       # 處理
│   └── models/          # 模型
├── notebooks/           # Jupyter Notebooks
├── src/                # Core
├── config/
├── tests/              # 測試
├── api/                # (Future) API
├── frontend/           # (Future) 前端介面
└── deployment/         # (Future) 部署

How To Start

1. Env

# clone project
git clone [your-repo-url]
cd sentiment-analysis-project

# venv
python -m venv venv
source venv/bin/activate  # for Linux/Mac
# or venv\Scripts\activate  # for Windows

# requirements
pip install -r requirements.txt

2. 執行分析

# start Jupyter Notebook
jupyter notebook

# 1. notebooks/01_data_collection.ipynb      - collect data
# 2. notebooks/02_data_exploration.ipynb     - (future)explore
# 3. notebooks/03_data_preprocessing.ipynb   - (future)preprocessing
# 4. notebooks/04_model_training.ipynb       - (future)模型訓練
# 5. notebooks/05_results_analysis.ipynb     - (future)結果

3. User Interface

from src.data_collector import ReviewCollector
from src.sentiment_analyzer import SentimentAnalyzer

# 收集評價
collector = ReviewCollector()
reviews = collector.collect_reviews("iPhone 15", max_reviews=100)

# 情感分析
analyzer = SentimentAnalyzer()

results = analyzer.predict(reviews['review'].tolist())

Main Features

Features Completed

  • 商品評論資料收集(mock datas)
  • 中文文本預處理
  • 多種視覺化圖表
  • 完整的 Jupyter 分析

Work In Progess

  • 情感分析模型訓練
  • 真實網站爬蟲功能
  • (更進階) NLP 模型
  • 商品分析

Future Plan

  • RESTful API
  • Web 前端介面
  • Docker 容器化部署
  • Cloud Service 整合
  • 即時監控 dashboard

Example: Data Result

情感分佈

  • 正面: 65%
  • 中性: 25%
  • 負面: 10%

關鍵發現

  • 消費者最關心的是產品品質和CP值
  • 負面評論主要集中在客服和物流體驗
  • 評論情感與評分有70%的一致性

About

A Python project that performs sentiment analysis on text data, providing insights into public opinion.

Topics

Resources

Stars

Watchers

Forks

Contributors