Advanced NLP pipeline using TF-IDF + Logistic Regression with Explainable AI token attribution, batch CSV processing, and a live Streamlit dashboard.
๐ Try it live โ
Type any text or upload a CSV and get instant sentiment predictions with explainability!
A fully interactive Sentiment Analysis Dashboard that goes beyond basic positive/negative prediction โ it shows which words drove the sentiment using Explainable AI token attribution.
Built for:
- Social media analysis (tweets, reviews)
- Customer feedback classification
- Batch processing of large text datasets
- Enter any text and get instant prediction
- Positive / Negative classification
- Confidence score with visual gauge bar
- Upload any CSV with a text column
- Full predictions table with sentiment labels
- Sentiment distribution bar chart
- Positive + Negative word clouds
- Dataset summary metrics
- Highlights top positive words boosting sentiment
- Highlights top negative words lowering sentiment
- Weighted importance score per word
- Makes the model transparent and interpretable
- Professional dashboard layout
- Two-tab interface: Live Analyzer + CSV Studio
- Clean typography and animated components
Raw Text Input
โ
โผ
Text Cleaning (NLTK)
โ
โผ
TF-IDF Vectorization
โ
โผ
Logistic Regression Model
โ
โโโโบ Sentiment Prediction (Positive/Negative)
โโโโบ Confidence Score
โโโโบ Token Weight Attribution (Explainability)
โ
โผ
Streamlit Dashboard
| Component | Technology |
|---|---|
| ML Model | Logistic Regression (scikit-learn) |
| Feature Engineering | TF-IDF Vectorizer |
| Explainability | Token Weight Attribution |
| NLP Preprocessing | NLTK |
| Visualizations | Matplotlib, WordCloud |
| UI & Deployment | Streamlit + Streamlit Cloud |
Sentiment-Analysis/
โ
โโโ app.py โ Streamlit dashboard (main entry)
โโโ sentiment_utils.py โ Prediction + Explainability engine
โโโ train_model.py โ Model training script
โโโ test_analysis.py โ Local testing script
โโโ requirements.txt
โ
โโโ models/
โโโ sentiment_model.joblib โ Trained model
โโโ tfidf_vectorizer.joblib โ Fitted vectorizer
# Clone the repo
git clone https://github.com/M1325-source/Sentiment-Analysis.git
cd Sentiment-Analysis
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.pyOpen http://localhost:8501 in your browser.
| Metric | Score |
|---|---|
| Algorithm | Logistic Regression |
| Features | TF-IDF (n-grams) |
| Dataset | Twitter Sentiment140 |
| Accuracy | ~85%+ |
- BERT / Transformer-based model upgrade
- Multi-class sentiment (Very Positive, Neutral, Very Negative)
- Real-time Twitter API integration
- Aspect-based sentiment analysis
- REST API endpoint for programmatic access
Manisha Priya โ AI/ML Engineer
- ๐ GitHub: @M1325-source
- ๐ง Email: manishapriya1325@gmail.com
โญ Star this repo if you found it useful!