An open API service indexing awesome lists of open source software.

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

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.

![Python](https://img.shields.io/badge/Python-3.7+-blue.svg)
![Flask](https://img.shields.io/badge/Flask-2.0+-green.svg)
![License](https://img.shields.io/badge/License-MIT-yellow.svg)

## ๐ŸŽฏ 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!