https://github.com/alexquilis1/news-sentiment-analyzer
A Flask web app that analyzes sentiment in news articles and generates word clouds to visualize emotional trends in current events
https://github.com/alexquilis1/news-sentiment-analyzer
data-visualization flask natural-language-processing news-api nlp nltk python sentiment-analysis vader-sentiment wordcloud
Last synced: 4 months ago
JSON representation
A Flask web app that analyzes sentiment in news articles and generates word clouds to visualize emotional trends in current events
- Host: GitHub
- URL: https://github.com/alexquilis1/news-sentiment-analyzer
- Owner: alexquilis1
- License: mit
- Created: 2023-10-29T21:52:37.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-30T12:44:37.000Z (4 months ago)
- Last Synced: 2025-06-30T13:46:55.858Z (4 months ago)
- Topics: data-visualization, flask, natural-language-processing, news-api, nlp, nltk, python, sentiment-analysis, vader-sentiment, wordcloud
- Language: Python
- Homepage:
- Size: 986 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ News Sentiment Analysis Web App
> A Flask-powered web application that analyzes sentiment in news articles and generates beautiful word clouds to visualize emotional trends in current events.



## ๐ฏ What it does
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!
## โจ Features
- **๐ 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
## ๐ ๏ธ Built With
- **[Flask](https://flask.palletsprojects.com/)** - Lightweight Python web framework
- **[News API](https://newsapi.org/)** - Real-time news data source
- **[NLTK](https://www.nltk.org/)** - Natural language processing toolkit
- **[VADER Sentiment](https://github.com/cjhutto/vaderSentiment)** - Lexicon-based sentiment analysis
- **[WordCloud](https://github.com/amueller/word_cloud)** - Word cloud generation
- **[Pandas](https://pandas.pydata.org/)** - Data manipulation and analysis
## ๐ Getting Started
### Prerequisites
- Python 3.7 or higher
- A [News API key](https://newsapi.org/register) (free tier available)
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/alexquilis1/news-sentiment-analyzer.git
cd news-sentiment-analyzer
```
2. **Install dependencies**
```bash
pip install -r requirements.txt
```
3. **Set up your API key**
Create a `config.py` file in the project root:
```python
API_KEY = "your_news_api_key_here"
```
4. **Download NLTK data** (first time only)
```python
import nltk
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')
```
### Usage
1. **Start the application**
```bash
python app.py
```
2. **Open your browser** and navigate to `http://localhost:5000`
3. **Enter a topic** (e.g., "climate change", "artificial intelligence", "olympics")
4. **Explore the results** - View sentiment distribution and word clouds!
## ๐ What I Learned
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
## ๐ค Contributing
Feel free to dive in! [Open an issue](https://github.com/alexquilis1/news-sentiment-analyzer/issues) or submit a pull request.
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐จโ๐ป Author
**Alex Quilis** - *Initial work* - [alexquilis1](https://github.com/alexquilis1)
---
โญ **Enjoyed this project?** Give it a star to show your support!