This project implements a deep learning model for emotion analysis in Vietnamese text, with both training pipeline and API endpoints for real-world applications.
- Accuracy: 62,2%
- F1-Score: 0.62
- Confusion Matrix Results are available in
reports/model_evaluation.ipynb
Detailed evaluation metrics for each emotion:
Emotion | Precision | Recall | F1-Score | Support |
---|---|---|---|---|
Anger | 0.41 | 0.35 | 0.38 | 40 |
Disgust | 0.59 | 0.61 | 0.60 | 132 |
Enjoyment | 0.70 | 0.67 | 0.68 | 193 |
Fear | 0.63 | 0.67 | 0.65 | 46 |
Sadness | 0.72 | 0.61 | 0.66 | 116 |
Surprise | 0.65 | 0.59 | 0.62 | 37 |
Other | 0.54 | 0.64 | 0.58 | 119 |
- Clone the repository:
git clone https://github.com/PhucHau0310/Emotion-Analysis.git
cd EmotionAnalyze
- Create and activate virtual environment:
python -m venv .venv
.\.venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Install Graphviz (for pipeline visualization):
- Download from: https://graphviz.org/download/
- Add to system PATH
cd root project
docker-compose up --build
cd be/src
python scripts/train.py
cd be
uvicorn src.main:app --reload
- YouTube Comments Analysis:
POST /analyze
{
"link": "https://www.youtube.com/watch?v=VIDEO_ID"
}
- Text Analysis:
POST /predict
{
"text": "Tôi rất vui khi gặp lại bạn!"
}
EmotionAnalyze/
├── be/
│ ├── src/
│ │ ├── models/
│ │ ├── utils/
│ │ ├── scripts/
│ │ └── config/
│ ├── reports/
│ ├── notebooks/
│ └── tests/
├── requirements.txt
├── fe/ (next.js)
├── docker-compose.yml
└── README.md
Create a .env
file in the root directory be:
YOUTUBE_API_KEY=your_api_key_here
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
- Nguyễn Phúc Hậu - Initial work
- Email: haunhpr024@gmail.com
- Github: PhucHau0310
- PhoBERT for providing pre-trained Vietnamese language model
- FastAPI for the web framework
- YouTube API for comment extraction capabilities