Skip to content

manu0312/Sentiment-Analysis-Pipeline

Repository files navigation

Sentiment Analysis Pipeline

πŸ“Œ Project Overview

This project is a Sentiment Analysis Pipeline that processes textual data to determine sentiment polarity (positive, negative, or neutral). It uses Natural Language Processing (NLP) techniques and machine learning models to analyze the sentiment of given text data.

πŸ“‚ Project Structure

πŸ“¦ Sentiment-Analysis-Pipeline
β”œβ”€β”€ app.py               # Main application file
β”œβ”€β”€ data_cleaning.py     # Data preprocessing script
β”œβ”€β”€ data_ingestion.py    # Data loading and processing script
β”œβ”€β”€ model.py             # Model training and evaluation script
β”œβ”€β”€ sentiment_analysis.iml  # Project configuration file
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ sentiment_analysis.postman_collection.json  # API collection for testing
β”œβ”€β”€ vectorizer.pkl       # Vectorizer file for text transformation
└── README.md            # Project documentation

πŸš€ Features

βœ… Preprocesses textual data (removes noise, tokenization, lemmatization) βœ… Supports multiple machine learning models (Logistic Regression, Naive Bayes, etc.) βœ… Uses TF-IDF vectorization for feature extraction βœ… Provides a REST API for sentiment analysis βœ… Outputs sentiment as Positive, Negative, or Neutral

πŸ›  Installation & Setup

  1. Clone the Repository
    git clone https://github.com/manu0312/Sentiment-Analysis-Pipeline.git
    cd Sentiment-Analysis-Pipeline
  2. Create a Virtual Environment (Optional but Recommended)
    python -m venv venv
    source venv/bin/activate  # On macOS/Linux
    venv\Scripts\activate     # On Windows
  3. Install Dependencies
    pip install -r requirements.txt

πŸ” Usage

1️⃣ Data Preprocessing

python data_cleaning.py

2️⃣ Train the Model

python model.py

3️⃣ Run the API

python app.py

The API will be available at: http://127.0.0.1:5000

🎯 Example API Usage

Send a POST request to the API:

curl -X POST http://127.0.0.1:5000/predict -H "Content-Type: application/json" -d '{"text": "I love this product!"}'

Response:

{
  "sentiment": "positive"
}

πŸ›  Technologies Used

  • Python 🐍
  • Flask (for API development)
  • Scikit-learn (for machine learning models)
  • NLTK (for text preprocessing)
  • Pandas & NumPy (for data manipulation)

πŸš€ Happy Coding! 😊

About

πŸ“Œ A Sentiment Analysis project using Machine Learning to classify text as Positive, Negative, or Neutral. It includes data preprocessing, model training, and a Flask API for real-time predictions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages