This application is a real-time Twitter sentiment analysis tool that allows users to track and visualize the sentiments associated with specific Twitter hashtags. Built with Python using PyQt5 for the user interface, tweepy for Twitter API access, and matplotlib for graph plotting, this application provides a dynamic and interactive way to analyze public opinions on social media.
Features
-
Real-Time Tweet Monitoring:
- The application listens to specific hashtags (e.g., #Debate2024) and retrieves the most recent tweets in real-time using the Twitter API.
- It continuously polls Twitter for new tweets, ensuring that the latest content is always available for sentiment analysis.
-
Sentiment Analysis:
- Using a custom sentiment analysis model, each tweet is classified as either "positive", "neutral", or "negative". Do you want the model? Please Contact Us
- The sentiment classification is displayed in a structured table alongside other relevant details, such as any places mentioned in the tweet.
-
Embedded Tweet Display:
- When a user clicks on a tweet in the sentiment table, the full tweet is displayed in the app, exactly as it appears on Twitter, including any media such as images, videos, or links.
- This is accomplished using Twitter’s embedded tweet feature, allowing users to view the tweet in its native format.
-
Geolocation and Place Extraction:
- The app uses Natural Language Processing (NLP) via spaCy to automatically detect and extract any geographic locations mentioned in the tweets.
- These locations are displayed in the table alongside the tweet's sentiment, helping users identify regional trends or discussions.
-
Sentiment Visualization:
- A real-time bar chart dynamically updates to visualize the sentiment distribution across the retrieved tweets.
- Users can track the overall sentiment trends, such as whether the majority of tweets are positive, neutral, or negative.
-
Interactive User Interface:
- The application features a user-friendly interface with interactive elements that allow users to click on rows in the table to view the corresponding tweet in its full form.
- The embedded tweets can be viewed just like they appear on Twitter, with clickable links, hashtags, and mentions.
Technologies Used
- Python:The core language for building the application.
- Custom made ML model:Used for predicting the sentiment
- PyQt5:Provides the graphical user interface, including the table for tweet data and embedded tweet display.
- PyQtWebEngine:Displays the tweets as they appear on Twitter, complete with images and media.
- Tweepy:Connects to the Twitter API for real-time data fetching.
- spaCy:An NLP library used to extract geographic locations (places) from tweets.
- Matplotlib:Creates dynamic sentiment visualizations (bar charts) that update in real-time.
- Twitter API:Used to fetch tweets based on specific hashtags and retrieve relevant tweet data like tweet IDs, text, and media.
Use Cases
- Brand Monitoring:Track how people are discussing your brand or campaign on social media in real-time.
- Social Media Research:Analyze the sentiment of conversations happening around specific events, trends, or locations.
- Public Opinion Analysis:Visualize and understand public sentiment towards certain topics or issues by tracking relevant hashtags.