A Streamlit-based sentiment analysis application trained on Nigeria-related Wikipedia content. It uses TF-IDF and a Random Forest classifier to predict sentiment with confidence scores. The app also provides TextBlob insights, word clouds, and interactive visualizations.
# π³π¬ Nigeria Wikipedia Sentiment Analysis
A **Streamlit-based Sentiment Analysis application** that predicts the sentiment of user-input text using a **Random Forest Classifier** trained on **Nigeria-related Wikipedia content**.
The app combines **machine learning predictions**, **TextBlob sentiment scores**, and **visual analytics** for better interpretability.
---
## π Project Overview
This project demonstrates how **Natural Language Processing (NLP)** and **Machine Learning** can be applied to analyze sentiment in textual data.
The model is trained on text extracted from **Wikipedia articles about Nigeria**, making it domain-specific and context-aware.
Users can input any sentence and instantly receive:
- Sentiment prediction (Positive / Negative)
- Prediction confidence
- Word cloud visualization
- TextBlob polarity and subjectivity insights
---
## π Features
### π Machine Learning Sentiment Prediction
- Uses a **Random Forest Classifier**
- Text transformed using **TF-IDF Vectorization**
- Outputs sentiment label with confidence scores
### βοΈ Word Cloud Visualization
- Generates a word cloud from user input
- Highlights dominant words in the sentence
### π§ Dual Sentiment Analysis
- **ML-based sentiment** (Random Forest)
- **Rule-based sentiment** (TextBlob)
### π Visual Analytics
- Probability bar chart for sentiment confidence
- Polarity & subjectivity visualization using Seaborn
### π₯οΈ Interactive UI
- Built using **Streamlit**
- Simple, clean, and user-friendly interface
---
## ποΈ Tech Stack
- **Frontend / App Framework**: Streamlit
- **Machine Learning**: Scikit-learn (Random Forest)
- **NLP**: TextBlob, NLTK
- **Vectorization**: TF-IDF
- **Visualization**: Matplotlib, Seaborn, WordCloud
- **Model Persistence**: Joblib
---
## π Project Structure
```bash
βββ app.py # Streamlit application
βββ Nigeria.ipynb # Data processing & model training notebook
βββ random_forest_sentiment_model.pkl # Train β¦