An open API service indexing awesome lists of open source software.

https://github.com/abhishekpsonawane07/restaurant-review-sentiment-analysis

Sentiment analysis of restaurant reviews using logistic regression. Predicts positive or negative sentiment and tracks review statistics with a user-friendly interface.
https://github.com/abhishekpsonawane07/restaurant-review-sentiment-analysis

colab-notebook food-reviews gradio-interface libraries nlp-machine-learning pandas percentage-calculations python sentiment-analysis sklearn-library

Last synced: 2 months ago
JSON representation

Sentiment analysis of restaurant reviews using logistic regression. Predicts positive or negative sentiment and tracks review statistics with a user-friendly interface.

Awesome Lists containing this project

README

        

# 🍽️ Restaurant Review Sentiment Analysis 🍽️

## πŸ“œ Project Overview

This project uses Natural Language Processing (NLP) to analyze restaurant reviews and determine whether they are **Positive** or **Negative**. It leverages machine learning to classify the sentiment and provides an interactive interface for users to submit their own reviews. The project also calculates the percentage of positive and negative reviews based on the data collected.

### ✨ Features:
- **Sentiment Classification**: Classifies reviews as **Positive** or **Negative** πŸŸ’πŸ”΄.
- **User Interaction**: Users can submit their reviews, and the sentiment is predicted instantly πŸ’¬πŸ”.
- **Data Storage**: Reviews and their sentiments are stored for future analysis πŸ“ŠπŸ’Ύ.
- **Sentiment Percentages**: Displays the percentage of positive and negative reviews based on collected data πŸ“ˆ.

---

## πŸ”§ Technologies Used

- **Programming Language**: Python 🐍
- **Libraries**:
- `pandas`: For data handling πŸ“Š
- `sklearn`: For machine learning and sentiment analysis 🧠
- `matplotlib` & `seaborn`: For visualizing results πŸ“‰
- `wordcloud`: For generating word clouds 🌈
- `gradio`: For creating the interactive web interface 🌐
- `ipywidgets`: For interactive widgets πŸŽ›οΈ

---

## βš™οΈ How It Works

1. **Data Input**: Users can input restaurant reviews manually or choose from sample reviews πŸ΄πŸ“.
2. **Sentiment Analysis**: The review is processed using a pre-trained model that classifies it as either Positive or Negative πŸ’‘.
3. **Output**: The sentiment prediction is displayed, and the review is stored for future reference πŸ’Ύ.
4. **Percentage Calculation**: After multiple reviews are submitted, the project calculates and displays the percentage of Positive vs Negative reviews πŸ“Š.
5. **Interactive Interface**: The project uses Gradio and ipywidgets to provide a seamless user experience πŸ–₯️.

---

## πŸ› οΈ Installation Instructions

1. Clone the repository:
```bash
git clone
cd
```

2. Install the required dependencies:
```bash
pip install -r requirements.txt
```

3. Run the project:
```bash
python sentiment_analysis.py
```

---

## πŸ§‘β€πŸ’» Usage

### Example Reviews:
- **Review**: "The food was delicious and the service was excellent!"
- **Predicted Sentiment**: Positive ✨

- **Review**: "Terrible experience, food was cold and service was slow."
- **Predicted Sentiment**: Negative πŸ’”

### Features:
- **Submit your review**: Type your review in the input box and see the sentiment prediction πŸ”.
- **Sample Reviews**: Click on sample review buttons to quickly load reviews and see the predictions 🍽️.
- **Sentiment Breakdown**: The interface shows the percentage of positive and negative reviews πŸ“ˆ.
- **Review History**: Your submitted reviews and their sentiment classification are displayed for easy reference πŸ“.

---

## πŸ’» Gradio Interface

The project includes an intuitive interface created with **Gradio**. Here’s how it’s structured:

1. **Restaurant Details**: Information about the restaurant and cuisine πŸ•πŸ”πŸ£.
2. **User Reviews**: Input a review, select from sample reviews, or see sentiment analysis results 🌟.
3. **Review History**: See a history of your submitted reviews and the sentiment breakdown πŸ“œ.
4. **Sentiment Percentages**: Displays the percentage of Positive vs Negative reviews based on the submitted data πŸ“Š.

---

## πŸ“Š Sample Output

- **Predicted Sentiment**: Positive or Negative πŸŸ’πŸ”΄
- **Sentiment Percentages**:
- **Positive Reviews**: 60.00% πŸ‘
- **Negative Reviews**: 40.00% πŸ‘Ž

---

## πŸ› οΈ Functions & Modules

- **`predict_sentiment(review)`**: Processes the input review and predicts whether it’s Positive or Negative.
- **`save_review(review, sentiment)`**: Saves the review and its sentiment, and updates the sentiment percentages.
- **`calculate_percentages()`**: Calculates the percentage of Positive and Negative reviews based on the stored reviews.

---

## πŸ“ˆ Example Usage

1. Input a review into the text box or choose a sample review using the provided buttons.
2. The system will classify the sentiment as **Positive** or **Negative**.
3. Your review will be saved, and the sentiment percentages will be updated.

---

## πŸ“ Contributing

Feel free to fork the repository and contribute! Here’s how you can get started:

1. Fork the repository.
2. Create your branch (`git checkout -b feature-name`).
3. Commit your changes (`git commit -am 'Add new feature'`).
4. Push to the branch (`git push origin feature-name`).
5. Create a pull request to merge your changes.

---

## πŸ›‘οΈ License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

## πŸ’‘ Future Enhancements
- **Multilingual Support**: Add sentiment analysis support for multiple languages 🌍.
- **Sentiment Visualization**: Improve sentiment visualization with word clouds and more charts πŸ§‘β€πŸŽ¨.
- **Model Improvement**: Experiment with different models for better accuracy 🧠.

---

## 🌟 Demo
---
![Image](https://github.com/user-attachments/assets/70741939-f50d-480f-af7c-f35b052d2710)

![Image](https://github.com/user-attachments/assets/facff9cb-56a7-414e-bce1-182e341d3a9a)