This Python script performs sentiment analysis on text data using a Support Vector Machine (SVM) classifier. It reads data from a CSV file, preprocesses the text, and trains an SVM model to classify the sentiment of each text into positive or negative.
- Python 3.x
- scikit-learn
- numpy
- pandas
Install the required libraries using the following command:
pip install scikit-learn numpy pandas
-
Prepare your data: Create a CSV file (
data.csv
) with two columns: 'text' containing the text data (sentences, reviews, etc.), and 'label' containing the corresponding sentiment labels (e.g., positive or negative). -
Run the script: Execute the Python script
Sentiment_Analysis.py
to perform sentiment analysis on the data.
The script will print the accuracy and classification report of the SVM model on the test set.
Srujana