Ứng dụng phân loại cảm xúc tiếng Việt sử dụng PhoBERT và Streamlit.
- Phân loại cảm xúc: POSITIVE, NEUTRAL, NEGATIVE
- Xử lý tiếng Việt: Hỗ trợ viết tắt, thiếu dấu, cụm từ đặc biệt
- Lưu lịch sử: Lưu lịch sử phân loại vào SQLite database
- Giao diện thân thiện: Streamlit UI đẹp mắt, dễ sử dụng
- Chuẩn hóa văn bản: Tự động chuẩn hóa văn bản tiếng Việt
- Python 3.8 đến 3.11 (khuyên dùng 3.11)
- pip
git clone https://github.com/MKha546/Sentiment_Assistant.git
cd Sentiment_Assistant# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtstreamlit run streamlit_app.pyỨng dụng sẽ mở tự động tại: http://localhost:8501
- Model:
wonrax/phobert-base-vietnamese-sentiment - Framework: Hugging Face Transformers
- Pipeline:
sentiment-analysis - Architecture: PhoBERT (Vietnamese RoBERTa)
Input Text (Tiếng Việt)
↓
Preprocessing (Chuẩn hóa văn bản)
↓
Sentiment Analysis (PhoBERT Pipeline)
↓
Output: {"text": "...", "sentiment": "POSITIVE"}
↓
Save to SQLite Database
Sentiment_Assistant/
├── streamlit_app.py # Ứng dụng chính
├── requirements.txt # Dependencies
├── .gitignore # Git ignore rules
├── README.md # File này
└── sentiments.db # SQLite database (tự động tạo)
- Nhập câu tiếng Việt vào ô text area
- Click nút "Phân loại"
- Xem kết quả:
- Nhãn cảm xúc: Tích cực / Trung tính / Tiêu cực
- Độ tin cậy (%)
- Câu đã chuẩn hóa
- Dictionary output:
{"text": "...", "sentiment": "POSITIVE"}
- Chuẩn hóa viết tắt: "rat" → "rất", "ko" → "không"
- Xử lý cụm từ đặc biệt: "buồn cười" → "hài hước"
- Hỗ trợ thiếu dấu: Tự động xử lý văn bản không dấu
{
"text": "Hôm nay tôi rất vui",
"sentiment": "POSITIVE"
}- SQLite:
sentiments.db - Bảng:
sentiments - Cột:
id,text,sentiment,timestamp - Lịch sử: Hiển thị 50 bản ghi mới nhất
streamlit>=1.29.0- Web frameworktransformers>=4.35.0- Hugging Face Transformerstorch>=2.1.0- PyTorchsentencepiece>=0.1.99- Tokenizationprotobuf>=4.25.0- Protocol buffers
- Xem file
HUONG_DAN_GITHUB.mdđể biết cách upload project lên GitHub - Xem file
THEORY.md(nếu có) để biết thêm về lý thuyết Transformer
Mọi đóng góp đều được chào đón! Vui lòng:
- Fork repository
- Tạo branch mới (
git checkout -b feature/AmazingFeature) - Commit thay đổi (
git commit -m 'Add some AmazingFeature') - Push lên branch (
git push origin feature/AmazingFeature) - Mở Pull Request
Project này được phát hành dưới MIT License.
[MINH KHA]
- VinAI Research - PhoBERT model
- Hugging Face - Transformers library
- Streamlit - Web framework
⭐ Nếu project này hữu ích, hãy cho một star! ⭐