/sentiment_analysis

Sentiment analysis identifies sentiment in text data, like reviews or tweets. We use BoW to represent each document as a word frequency vector and logistic regression for classification.

Primary LanguageJupyter Notebook

Sentiment Analysis with Bag-of-Words and Logistic Regression

This project implements a sentiment analysis model using the Bag-of-Words (BoW) technique and logistic regression. The model is trained to classify text documents as either positive or negative sentiment.

Overview

Sentiment analysis is the process of determining the sentiment expressed in a piece of text, such as a review, tweet, or comment. In this project, we utilize the Bag-of-Words approach, which represents each document as a vector of word frequencies, and logistic regression to classify the sentiment of the text.

Accuracy

image

Features

  • Bag-of-Words Representation: Transforming text data into numerical vectors based on word frequency.
  • Logistic Regression Model: A simple yet effective classification algorithm used for sentiment analysis.
  • Flask Web Application: Deploy the trained model as a web service using Flask, allowing users to input text and receive sentiment predictions.

Installation

  1. Clone the repository:

    git clone https://github.com/theprince29/sentiment_analysis.git
    cd sentiment-analysis
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    

Usage

  1. Training the Model:

    • Prepare your dataset of text documents labeled with sentiment (positive or negative).

    • Run the training script to train the sentiment analysis model:

      python train.py --data_path /path/to/dataset
      
  2. Starting the Flask Web Application:

    • Launch the Flask web application to interact with the trained model:

      python app.py
      
    • Access the web application at http://localhost:5000 in your web browser.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • This project was inspired by [reference/source].
  • Special thanks to [contributors], who contributed to the development of this project.

Contact

For any questions or inquiries, please contact [princepalknp0402@gmail.com].