Skip to content

This project performs sentiment analysis on restaurant reviews using Natural Language Processing (NLP) techniques and a Naive Bayes classifier. The dataset contains labeled customer reviews (positive/negative). The goal is to build a model that accurately classifies the sentiment of new customer reviews.

License

Notifications You must be signed in to change notification settings

BhagyashreeMohalkar/Sentiment_Analysis_of_Restaurant_Reviews

Repository files navigation

🍽️ Sentiment Analysis of Restaurant Reviews

This project performs sentiment analysis on restaurant reviews using 🧠 Natural Language Processing (NLP) and a 🤖 Naive Bayes classifier. It classifies each review as positive ✅ or negative ❌ based on its content.


✨ Features

  • 🧹 Clean and preprocess text data
  • ❌ Remove stopwords using NLTK
  • 🌱 Apply stemming using PorterStemmer
  • 🧾 Extract features with CountVectorizer
  • 🤖 Train a MultinomialNB sentiment classifier
  • 📊 Evaluate model performance with a confusion matrix and accuracy score
  • 📝 Predict sentiment for a custom review

🧾 Requirements

Symbol Requirement (Library)
📄 pandas
🔍 re
📘 nltk
🧾 sklearn.feature_extraction.textCountVectorizer
🤖 sklearn.naive_bayes
✂️ sklearn.model_selection
📊 sklearn.metrics

📁 Dataset

  • File: Restaurant_Reviews.tsv

📌 Make sure the dataset is placed in the same folder as the notebook.


⚙️ Workflow

  1. 📥 Load dataset using pandas
  2. 🧹 Clean text: remove non-letter characters, convert to lowercase
  3. ❌ Remove stopwords using NLTK
  4. 🌱 Apply stemming with PorterStemmer
  5. 🧾 Convert text to features using CountVectorizer
  6. ✂️ Split data into training and testing sets
  7. 🤖 Train a Naive Bayes classifier
  8. 📊 Evaluate with confusion matrix & accuracy
  9. 🔍 Predict sentiment for a new review

🚀 How to Run

1️⃣ Clone the Repository

git clone https://github.com/BhagyashreeMohalkar/Sentiment-Analysis-Restaurant.git
cd Sentiment-Analysis-Restaurant

2️⃣ Install Required Libraries

pip install nltk scikit-learn pandas

3️⃣ Launch the Notebook

jupyter notebook Sentiment_Analysis_of_Restaurant_Reviews.ipynb

📝 Ensure that Restaurant_Reviews.tsv is in the same directory.


📊 Sample Output

🧾 Confusion Matrix

[[91  9]
 [17 83]]

🎯 Accuracy Score

0.87

👩‍💻 Author

Bhagyashree Savata Mohalkar
🎓 Electronics & Computer Engineer

🔗 LinkedIn | 🐙 GitHub


🌟 Support

If you found this project helpful, don’t forget to ⭐ the repository. Your support encourages more projects like this! 😊


About

This project performs sentiment analysis on restaurant reviews using Natural Language Processing (NLP) techniques and a Naive Bayes classifier. The dataset contains labeled customer reviews (positive/negative). The goal is to build a model that accurately classifies the sentiment of new customer reviews.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published