This repository contains a project for performing sentiment analysis using Natural Language Processing (NLP) and machine learning. The aim is to classify text data into positive, negative, or neutral sentiments.
Sentiment analysis is a crucial task in NLP that helps in understanding the emotional tone behind a series of words. It has applications in various fields such as customer feedback analysis, social media monitoring, and market research.
A sample dataset containing 100 rows is used for this project. Each row consists of a text and its corresponding sentiment label (positive, negative, neutral).
sentiment_dataset.csv
: The dataset file containing 100 rows of text and sentiment labels.sentiment_analysis.ipynb
: Jupyter Notebook containing the code for loading data, preprocessing, training the model, and evaluating its performance.sentiment_model.pkl
: The trained sentiment analysis model.tfidf_vectorizer.pkl
: The TF-IDF vectorizer used for transforming text data.
Make sure you have the following libraries installed:
- pandas
- scikit-learn
- joblib
- google.colab (for Colab usage)
-
Clone the repository:
git clone https://github.com/your-username/sentiment-analysis-nlp.git cd sentiment-analysis-nlp
-
Install the required Python packages:
pip install pandas scikit-learn joblib
-
Upload the dataset to your Google Colab environment:
from google.colab import files uploaded = files.upload()
-
Run the
sentiment_analysis.ipynb
notebook to preprocess data, train the model, and evaluate its performance.
The model is evaluated based on accuracy, precision, recall, and F1 score. Detailed performance metrics can be found in the code.