Skip to main content

Sentiment Analysis pipeline

Project description

๐Ÿ’ฌ Sentiment Analysis Pipeline

This repository hosts an easy-to-use, ready-made Sentiment Analysis pipeline designed to get you started quickly with classifying text data. Everything you need, from data preprocessing to model training and prediction, is set up and configured.


โœจ Features

  • End-to-End Pipeline: Go from raw text to sentiment predictions with minimal setup.
  • Automated Preprocessing: Includes robust text cleaning:
    • Lemmatization
    • Stop word removal
    • Punctuation handling
    • URL/emoji/HTML removal, etc.
  • Multiple Text Representation Methods:
    • Bag-of-Words (BoW)
    • Term Frequency (TF)
    • TF-IDF (Term Frequency-Inverse Document Frequency)
    • Word Embeddings (Word2Vec - pre-trained Google News 300-dim model)
  • Multiple Machine Learning Algorithms:
    • Logistic Regression
    • Random Forest
    • XGBoost
  • Hyperparameter Tuning Support:
    • All models are compatible with GridSearchCV.
    • By default, models run with standard parameters for quick testing.
    • Grid search options are built-in and ready to use if needed.
  • Modular Design: Each component is cleanly separated into its own module.
  • Prediction on New Data: Easily apply your trained model to new, unseen data.

๐Ÿš€ Getting Started

Follow these steps to get your sentiment analysis pipeline up and running:

1. Prerequisites

  • Git: For cloning the repository.
  • Python 3.8+ (Recommended: Anaconda for environment management)
  • Anaconda/Miniconda: Strongly recommended

2. Clone the Repository

git clone https://github.com/AlabhyaMe/Sentimental-Analysis-.git
cd Sentimental-Analysis-
conda create -n sentiment_env python=3.9
conda activate sentiment_env
pip install -r requirements.txt
This project is setup in the follwing pipeline
โ”œโ”€โ”€ Training Data/
โ”‚   โ””โ”€โ”€ train.csv                # Your training file
โ”œโ”€โ”€ New Data/
โ”‚   โ””โ”€โ”€ new_texts.csv            # Your new prediction file
โ”œโ”€โ”€ MLAlgo/
โ”‚   โ”œโ”€โ”€ logistic_regression_model.py
โ”‚   โ”œโ”€โ”€ random_forest_model.py
โ”‚   โ””โ”€โ”€ xgboost_model.py
โ”œโ”€โ”€ Vect/
โ”‚   โ”œโ”€โ”€ bag_of_words_vectorizer.py
โ”‚   โ”œโ”€โ”€ tfidf_vectorizer.py
โ”‚   โ””โ”€โ”€ word_embedding_vectorizer.py
โ”œโ”€โ”€ preprocessing.py             # Text cleaning functions
โ”œโ”€โ”€ sentiment_analysis_main.ipynb  # Full training + prediction notebook
โ”œโ”€โ”€ sentiment_prediction.ipynb     # Quick prediction-only notebook
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md


3. Prepare Your Data

๐Ÿ“Œ Training Data

Place your training CSV file in the Training Data/ folder.

  • It must contain:
    • A column named Response โ€“ for the raw input text.
    • A column named Sentiment โ€“ for sentiment labels (e.g., "Positive", "Negative", "Neutral").

๐Ÿ“Œ New Data for Prediction

Place your new prediction CSV file in the New Data/ folder.

  • It must contain:
    • A column named RawTextColumn (or another name you configure in the notebook).

๐Ÿ“š Dataset Citation

This project uses publicly available training data from:

Madhav Kumar Choudhary. Sentiment Prediction on Movie Reviews. Kaggle.
https://www.kaggle.com/datasets/madhavkumarchoudhary/sentiment-prediction-on-movie-reviews
Accessed on: 2025- 07-15

If you use this dataset in your own work, please cite the original creator as per Kaggle's Terms of Use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quick_sentiments-0.1.9.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quick_sentiments-0.1.9-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file quick_sentiments-0.1.9.tar.gz.

File metadata

  • Download URL: quick_sentiments-0.1.9.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for quick_sentiments-0.1.9.tar.gz
Algorithm Hash digest
SHA256 0c5071235854558c379e4455d2290e9b4f26d4b6fbee25761d25c86ecb541c13
MD5 6242a66273a8e72d878a4380a8f2fddd
BLAKE2b-256 be5e2c28cf0cff3af59c582e85d82f5aafbccf50d716fa8b15aae3f2e219439d

See more details on using hashes here.

File details

Details for the file quick_sentiments-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for quick_sentiments-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 86a8853873bcd20a637d579a609cfdc804aece70f6ea96f91f7437100a6799ef
MD5 a796a5b0a7c4a781c4261bc2dbfa1ea0
BLAKE2b-256 0f1de2dc5e92b6d8e70f8a985f2630ede7196158a8c2679fd0f9fc4abefd0b70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page