A Flask-powered web application that analyzes sentiment in news articles and generates beautiful word clouds to visualize emotional trends in current events.
This web app takes any topic you're curious about and:
- 🔍 Fetches the latest news articles from across the web
- 🧠 Analyzes the emotional tone of each article
- 📈 Shows you whether the coverage is positive, negative, or neutral
- ☁️ Creates stunning word clouds to visualize the most common terms
Perfect for understanding public sentiment on current events, trending topics, or any subject you're researching!
- 🔎 Smart Topic Search - Enter any keyword and get relevant news articles
- 😊😐😞 Sentiment Classification - Automatic categorization into positive, negative, and neutral
- 📊 Visual Analytics - Beautiful charts showing sentiment distribution
- ☁️ Word Cloud Generation - Separate word clouds for each sentiment category
- 🧹 Intelligent Text Processing - Removes noise, URLs, and irrelevant content
- 🌐 Real-time Data - Fresh news articles from the News API
- Flask - Lightweight Python web framework
- News API - Real-time news data source
- NLTK - Natural language processing toolkit
- VADER Sentiment - Lexicon-based sentiment analysis
- WordCloud - Word cloud generation
- Pandas - Data manipulation and analysis
- Python 3.7 or higher
- A News API key (free tier available)
-
Clone the repository
git clone https://github.com/alexquilis1/news-sentiment-analyzer.git cd news-sentiment-analyzer -
Install dependencies
pip install -r requirements.txt
-
Set up your API key
Create a
config.pyfile in the project root:API_KEY = "your_news_api_key_here"
-
Download NLTK data (first time only)
import nltk nltk.download('punkt') nltk.download('stopwords') nltk.download('wordnet')
-
Start the application
python app.py
-
Open your browser and navigate to
http://localhost:5000 -
Enter a topic (e.g., "climate change", "artificial intelligence", "olympics")
-
Explore the results - View sentiment distribution and word clouds!
This was one of my early Python projects where I explored:
- Web development with Flask
- Natural language processing techniques
- Data visualization and web scraping
- API integration and data manipulation
- Text preprocessing and sentiment analysis algorithms
Feel free to dive in! Open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
Alex Quilis - Initial work - alexquilis1
⭐ Enjoyed this project? Give it a star to show your support!