Skip to content

Repository files navigation

Vietnamese Sentiment Analysis

This project implements sentiment analysis for Vietnamese text using multiple machine learning approaches including SVM, Decision Tree, CNN, and LSTM models.

Dataset

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)

Models Implemented

1. Traditional Machine Learning

  • SVM (Support Vector Machine): Using TF-IDF vectorization
  • Decision Tree: For comparison with SVM performance

2. Deep Learning Models

  • CNN (Convolutional Neural Network): Using 1D convolutions for text classification
  • LSTM (Long Short-Term Memory): For sequential text processing

Files Structure

├── 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

Usage

Running the Models

  1. Open model.ipynb in Jupyter Notebook or VS Code
  2. Run cells sequentially to train and evaluate different models
  3. Use the prediction functions to classify new Vietnamese text

Example Prediction

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)

Model Performance

The models are evaluated on test datasets with accuracy metrics displayed in the notebook.

Requirements

  • pandas
  • numpy
  • scikit-learn
  • tensorflow/keras
  • matplotlib
  • openpyxl (for Excel file handling)

Installation

pip install pandas numpy scikit-learn tensorflow matplotlib openpyxl

Data Preprocessing

The preprocessing pipeline includes:

  • Text normalization
  • Stopword removal
  • Teencode conversion
  • Label remapping (1-5 star ratings to 3 sentiment categories)

Contributing

Feel free to fork this project and submit pull requests for improvements.

License

This project is for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages