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 …