Git Product home page Git Product logo

shabisht / sentiment-analysis-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24.54 MB

a comprehensive tool designed to evaluate the sentiment of movie reviews. Hosted the ML model as a REST API, easily accessible from any application using json request.

Home Page: https://movie-counsel.streamlit.app/Sentiment_Analysis

Python 98.11% Procfile 1.89%
complement-navie-bayes fastapi json-api logistic-regression nltk-python pandas-numpy-matplotlib-plotly porter-stemmer-algorithm xgboost beautifulsoup4

sentiment-analysis-api's Introduction

Sentiment Analyzer for Movie Reviews

Site Linkedin Hosted-on python Sentiment

Overview

Sentiment Analyzer for Movie Reviews is a comprehensive tool designed to evaluate the sentiment of movie reviews. This project is an integral part of the Movie Counsel web application, which empowers users to explore and discover movies tailored to their preferences.

Key Features:

  • Sentiment Analyzer is implemented as a robust API using the FastAPI framework.
  • The API is hosted on the Render cloud platform, ensuring scalability, reliability, and ease of deployment.
  • Sentiment analysis models are trained on a vast dataset comprising approximately 180,000 movie reviews sourced from IMDB.
  • The reviews are scrapped from IMDB for both Hollywood and Bollywood releases from 2019 to September 2023 with help of Beautiful Soup.

Data Preprocessing

The heart of any sentiment analysis model is the quality of its training data. Therefore, the dataset undergoes a rigorous preprocessing phase to optimize its quality for analysis.

Data Cleaning and Preprocessing Tasks Include:

  • Correcting data formats to ensure uniformity and consistency with help of Pandas.
  • Assigning review labels, i.e., classifying reviews as positive or negative based on the accompanying ratings.
  • Removing special characters and symbols from the text, facilitating more accurate sentiment analysis.
  • Applying word stemming techniques to further enhance the quality of the text data with help of nltk.
  • visit the Google Colab notebooks in this ๐Ÿ“ for detailed analysis.

Model Building

Sentiment Analyzer leverages state-of-the-art machine learning algorithms to create an accurate and robust sentiment classification model.

Model Building Highlights:

  • Combination of machine learning algorithms, including Logistic Regression, Complement Naive Bayes, and XGBoost, to achieve precise sentiment classification.
  • Incorporation of pretrained models such as roBERTa to expedite the training process and enhance overall performance.
  • Continuous model evaluation and refinement to ensure the highest level of sentiment analysis accuracy.
  • visit the Google Colab notebooks in this ๐Ÿ“ for detailed analysis.

Web API

To make sentiment analysis accessible and user-friendly, Sentiment Analyzer provides a comprehensive web API. Users can interact with the API to gain insights into the sentiment of movie reviews.

Key API Features:

  • Accepts HTTP POST requests containing movie reviews as input.

  • Returns the probability of both negative and positive sentiments predicted by each model.

  • Enables users to integrate sentiment analysis capabilities into their own applications and projects.

  • Request

{
  "reviews": "This movie was absolutely fantastic! I loved every moment of it."
}
  • Response - model:[negative score, positive score]
{
    "logistic_regression": {[0.15, 0.85]},
    "complement_naive_bayes": {[0.18, 0.82]},
    "xgboost": {[0.13, 0.87]}
}

Installation

To set up and use Sentiment Analyzer in your own project, follow these steps:

  • Clone this repository to your local machine.
    git clone https://github.com/peskyji/Sentiment-Analysis.git
  • Install the required dependencies for python 3.8 or above.
    pip install -r requirements.txt
  • Run the FastAPI application
uvicorn fastapi_app:app --reload

Acknowledgments

I would like to express my gratitude to the open-source community and the developers of FastAPI for their invaluable contributions.

Happy sentiment analyzing!

sentiment-analysis-api's People

Contributors

shabisht avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.