This project implements sentiment analysis for Vietnamese text using multiple machine learning approaches including SVM, Decision Tree, CNN, and LSTM models.
The project uses preprocessed Vietnamese review data to classify sentiments into three categories:
- Tiêu cực (Negative)
- Trung tính (Neutral)
- Tích cực (Positive)
- SVM (Support Vector Machine): Using TF-IDF vectorization
- Decision Tree: For comparison with SVM performance
- CNN (Convolutional Neural Network): Using 1D convolutions for text classification
- LSTM (Long Short-Term Memory): For sequential text processing
├── model.ipynb # Main notebook with all models
├── preprocessing.py # Data preprocessing scripts
├── preprocessed_data.xlsx # Preprocessed dataset
├── data_final.xlsx # Original dataset
├── vietnamese-stopwords.txt # Vietnamese stopwords list
├── teencode.txt # Teencode dictionary
├── bad_words.json # Bad words list
├── work_TIEN_XU_LY.ipynb # Additional preprocessing work
└── visualize.ipynb # Data visualization
- Open
model.ipynbin Jupyter Notebook or VS Code - Run cells sequentially to train and evaluate different models
- Use the prediction functions to classify new Vietnamese text
new_reviews = [
"hàng tốt, giao đúng màu, shop hỗ trợ nhiệt tình",
"sản phẩm không như mong đợi, chất lượng kém"
]
# For LSTM model
predicted_sentiments = predict_sentiments_lstm(new_reviews)The models are evaluated on test datasets with accuracy metrics displayed in the notebook.
- pandas
- numpy
- scikit-learn
- tensorflow/keras
- matplotlib
- openpyxl (for Excel file handling)
pip install pandas numpy scikit-learn tensorflow matplotlib openpyxlThe preprocessing pipeline includes:
- Text normalization
- Stopword removal
- Teencode conversion
- Label remapping (1-5 star ratings to 3 sentiment categories)
Feel free to fork this project and submit pull requests for improvements.
This project is for educational purposes.