Skip to content

A machine learning project that analyzes the sentiment of tweets using a Support Vector Machine (SVM) classifier. The model is trained to classify tweets as positive, negative, or neutral based on the textual content, using NLP techniques like tokenization, TF-IDF vectorization, and data cleaning.

License

Notifications You must be signed in to change notification settings

muqadasejaz/Twitter-Sentiment-Analysis-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

💬 Twitter Sentiment Analysis

Twitter Sentiment Analysis is the process of using Python to understand the emotions or opinions expressed in tweets automatically. By analyzing the text, we can classify tweets as positive (1) or negative (0). This helps businesses and researchers track public mood, brand reputation, or reactions to events in real time.

This project includes a trained machine learning model, a user-friendly desktop GUI, and utilizes natural language processing techniques to make sentiment predictions from tweet text input.


📌 Overview

  • Build a logistic regression model to classify sentiments in tweets.

  • Create a graphical interface using Tkinter for user interaction.

  • Predict the sentiment of custom tweet inputs (0 = Negative, 1 = Positive).

  • Accuracy of trained model: 80%


✨ Features

  • 🔍 Predict sentiment of custom tweets in real-time.

  • 🧠 Trained model with 88% accuracy.

  • 📊 Clean and interactive desktop GUI.

  • 🎯 Easy to use for non-technical users.

  • 📦 Fully open-source and customizable.


📁 Dataset

The dataset used is the Sentiment140 dataset, which contains:

  • 1.6 million tweets

  • Pre-labeled as 0 = Negative and 1 = Positive

  • Dataset includes tweet text and metadata

📂 Dataset link: Sentiment140 on Kaggle


✅ Result

  • Model Used: SVM Classifier

  • Vectorizer: TF-IDF

  • Accuracy Achieved: 80%

  • Sample Predictions:

    • "I love this new phone!" → Positive (1)

    • "Worst service ever." → Negative (0)

    • Sentiment Distribution:

      image
    • Confusion Matrix:

      image

🛠 Tools & Technologies

Tool/Library Purpose
Python Core programming language
Scikit-learn Model training (SVM Classifier)
NLTK Tokenization, preprocessing
TextBlob Sentiment feature extraction
Tkinter GUI development
Pandas Data manipulation
Matplotlib Visualization
Joblib Model saving/loading
PIL (Pillow) Displaying GUI images

📸 GUI Preview

  • Positive:
prediction
  • Negative:

    predictions jpg

🔗 References


👩‍💻 Author

Muqadas Ejaz

BS Computer Science (AI Specialization)

Machine Learning & Computer Vision Enthusiast

📫 Connect with me on LinkedIn

🌐 GitHub: github.com/muqadasejaz


📝 License

This project is licensed under the MIT License.

About

A machine learning project that analyzes the sentiment of tweets using a Support Vector Machine (SVM) classifier. The model is trained to classify tweets as positive, negative, or neutral based on the textual content, using NLP techniques like tokenization, TF-IDF vectorization, and data cleaning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published