This project aims to analyze the sentiment of YouTube video comments using a pre-trained BERT model and KMeans clustering. The analysis includes visualization of sentiment distributions and clustering results.
- Clone the repository:
git clone https://github.com/BozhengLong/youtube-sentiment-analysis.git
cd youtube-sentiment-analysis- Create and activate a virtual or conda environment:
conda create --n myenv
conda activate myenv- Install the required packages:
pip install -r requirements.txt- Load and initialize the BERT model:
Modify the API_KEY and VIDEO_ID in comment_sentiment_analysis.py with your own YouTube API key and video ID.
- Run the sentiment analysis:
python comment_sentiment_analysis.py