Skip to content

SathwikPatel12/SentimentAnalysis-Streamlit

Repository files navigation


🎭 AI Sentiment Analysis Dashboard

A comprehensive sentiment analysis application built with advanced NLP techniques and deployed on Streamlit Cloud.

Python Streamlit scikit-learn License

πŸ“š Table of Contents


πŸš€ Live Demo

Try the App Live!

✨ Features

πŸ” Single Text Analysis

  • Real-time sentiment prediction
  • Confidence scores with probability breakdown
  • Interactive visualizations
  • Text preprocessing insights

πŸ“‹ Batch Processing

  • Analyze multiple texts simultaneously
  • Batch results with summary statistics
  • Export functionality

πŸ“ˆ Analytics Dashboard

  • Historical analysis trends
  • Confidence distribution charts
  • Performance metrics
  • Data insights

πŸ•’ History Tracking

  • Complete analysis history
  • Timestamp tracking
  • Pattern recognition

πŸ€– Machine Learning Pipeline

Data Preprocessing

  • Text normalization and cleaning
  • Stopword removal
  • Lemmatization
  • N-gram feature extraction

Feature Engineering

  • TF-IDF Vectorization: Advanced term frequency analysis
  • Count Vectorization: Bag-of-words representation
  • N-grams: Unigrams and bigrams for context

Model Selection

  • Multiple algorithms tested:
    • Naive Bayes
    • Logistic Regression
    • Random Forest
    • Support Vector Machine
  • Hyperparameter optimization
  • Cross-validation for robust performance

πŸ“Š Performance Metrics

Model Accuracy Precision Recall F1-Score
Best Model 70%+ 0.85+ 0.80+ 0.80+

πŸ› οΈ Technology Stack

  • Frontend: Streamlit
  • Backend: Python 3.9+
  • ML Libraries: scikit-learn, NLTK
  • Visualization: Plotly, Matplotlib, Seaborn
  • Deployment: Streamlit Cloud
  • Version Control: Git & GitHub

πŸ“¦ Installation & Setup

Prerequisites

  • Python 3.9 or higher
  • Git

πŸš€ Deployment on Streamlit Cloud

Quick Deployment Steps

  1. Push to GitHub

    git add .
    git commit -m "Initial commit"
    git push origin main
  2. Deploy on Streamlit Cloud

    • Visit share.streamlit.io
    • Connect your GitHub repository
    • Select your repository and branch
    • Set main file path: app.py
    • Click "Deploy!"
  3. Automatic Updates

    • Any push to your GitHub repository will automatically update your deployed app

πŸ“ Project Structure

sentiment-analysis-dashboard/
β”‚
β”œβ”€β”€ app.py                          # Main Streamlit application
β”œβ”€β”€ sentiment_analysis_model.pkl    # Trained ML model
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ README.md                     # Project documentation
β”œβ”€β”€ preprocessing.py              # Data preprocessing scripts
β”œβ”€β”€ model_training.py            # Model training pipeline
β”‚
β”œβ”€β”€ data/                        # Data directory
β”‚   β”œβ”€β”€ raw/                    # Raw datasets
β”‚   └── processed/             # Cleaned datasets
β”‚
β”œβ”€β”€ notebooks/                  # Jupyter notebooks
β”‚   β”œβ”€β”€ EDA.ipynb             # Exploratory Data Analysis
β”‚   β”œβ”€β”€ preprocessing.ipynb   # Data preprocessing
β”‚   └── modeling.ipynb       # Model development
β”‚
└── assets/                   # Static assets
    β”œβ”€β”€ screenshots/         # App screenshots
    └── demo/               # Demo files

πŸ“Έ Screenshots

πŸ”Ή Main Dashboard

Main Dashboard

πŸ”Ή Analysis Results

Analysis Results

πŸ”Ή History Tracker

History Tracker

πŸ”Ή Batch Processing

Batch Processing


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ› οΈ Development Workflow

  • Fork the repository
  • Create your feature branch: git checkout -b feature/AmazingFeature
  • Commit your changes: git commit -m 'Add AmazingFeature'
  • Push to the branch: git push origin feature/AmazingFeature
  • Open a Pull Request

πŸ“Š Model Performance Details

Training Data

  • Dataset Size: [(1440 Records, 5 Fields)]
  • Features: Preprocessed text data
  • Labels: Positive, Negative, Neutral

🧾 Example Input

"It's a very bad product, highly dissatisfied.. Specifically the colour is too whitish and unreal display.. Won't recommend to buy, instead go for M31.. It hangs as well within less than a month of purchase."

βœ… Output

  • Predicted Sentiment: Negative
  • Confidence: 79.5%
  • Top Keywords: bad, product, highly, dissatisfied, specifically, colour

Evaluation Results

Classification Report:
                precision    recall  f1-score   support

    Negative       0.75      0.75      0.75       102
     Neutral       0.25      0.30      0.30       40
    Positive       0.81      0.77      0.80       146

    accuracy                           0.72      288
   macro avg       0.61      0.61      0.60      288
weighted avg       0.71      0.70      0.71      288
image

πŸ› Known Issues

  • Large text inputs (>10,000 characters) may take longer to process
  • NLTK downloads required on first run

πŸ™ Acknowledgments

  • NLTK for natural language processing tools
  • scikit-learn for machine learning algorithms
  • Streamlit for the amazing web framework
  • Plotly for interactive visualizations

πŸ“ž Contact

Your Name - sathwikyalagala@gmail.com

Project Link: https://github.com/SathwikPatel12/SentimentAnalysis-Streamlit

Live Demo: https://sentimentanalysis-app-ctenkjk48urxzuudzft2pk.streamlit.app/


⭐ Star this repository if you found it helpful! ⭐

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors