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.
- Host: GitHub
- URL: https://github.com/abhishekpsonawane07/restaurant-review-sentiment-analysis
- Owner: abhishekpsonawane07
- License: mit
- Created: 2025-01-23T19:15:49.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-23T19:20:33.000Z (4 months ago)
- Last Synced: 2025-02-01T23:39:36.351Z (4 months ago)
- Topics: colab-notebook, food-reviews, gradio-interface, libraries, nlp-machine-learning, pandas, percentage-calculations, python, sentiment-analysis, sklearn-library
- Language: Jupyter Notebook
- Homepage:
- Size: 706 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
---
