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.
- 🧹 Clean and preprocess text data
- ❌ Remove stopwords using NLTK
- 🌱 Apply stemming using
PorterStemmer - 🧾 Extract features with
CountVectorizer - 🤖 Train a
MultinomialNBsentiment classifier - 📊 Evaluate model performance with a confusion matrix and accuracy score
- 📝 Predict sentiment for a custom review
| Symbol | Requirement (Library) |
|---|---|
| 📄 | pandas |
| 🔍 | re |
| 📘 | nltk |
| 🧾 | sklearn.feature_extraction.text – CountVectorizer |
| 🤖 | sklearn.naive_bayes |
| ✂️ | sklearn.model_selection |
| 📊 | sklearn.metrics |
- File:
Restaurant_Reviews.tsv
📌 Make sure the dataset is placed in the same folder as the notebook.
- 📥 Load dataset using
pandas - 🧹 Clean text: remove non-letter characters, convert to lowercase
- ❌ Remove stopwords using NLTK
- 🌱 Apply stemming with
PorterStemmer - 🧾 Convert text to features using
CountVectorizer - ✂️ Split data into training and testing sets
- 🤖 Train a Naive Bayes classifier
- 📊 Evaluate with confusion matrix & accuracy
- 🔍 Predict sentiment for a new review
git clone https://github.com/BhagyashreeMohalkar/Sentiment-Analysis-Restaurant.git
cd Sentiment-Analysis-Restaurantpip install nltk scikit-learn pandasjupyter notebook Sentiment_Analysis_of_Restaurant_Reviews.ipynb📝 Ensure that Restaurant_Reviews.tsv is in the same directory.
[[91 9]
[17 83]]
0.87
Bhagyashree Savata Mohalkar
🎓 Electronics & Computer Engineer
If you found this project helpful, don’t forget to ⭐ the repository. Your support encourages more projects like this! 😊