- Introduction
- Features
- System Design
- Project Structure
- Dependencies
- Installation
- Usage
- Acknowledgements
- Disclaimer
- License
News Analyzer is a Python-based project designed to analyze news articles and provide insights into their potential impact on Sri Lankan citizens. The project utilizes the Google AI Platform (PALM) to categorize news articles based on their sentiment and relevance to various social, economic, and political spheres.
- News URL Extraction: The system automatically extracts news article URLs from a provided CSV file containing news article titles and URLs.
- Content Retrieval: The script fetches the content of each news article using web scraping techniques.
- Sentiment Analysis with PALM: The project uses the PaLM API to perform sentiment analysis on the extracted news content.
- Categorization: The system classifies news articles into categories based on their potential impact on Sri Lankan society, including positive, negative, and neutral categories.
- Detailed Output: Results are saved in a CSV file containing the news title, URL, PALM response, and sub-category classification.
The News Analyzer System is designed to provide comprehensive analysis of news articles to discern their potential impacts on various facets of Sri Lankan society. Utilizing the Google AI Platform (PALM), the system efficiently categorizes news articles based on sentiment and relevance across social, economic, and political domains.
Tip
You can find the detailed system design in the System Design document.
The project is organized into two main Python scripts:
-
This script handles the core functionality of news analysis, including
- Reading news URLs from a CSV file
- Retrieving news article content
- Performing sentiment analysis using PALM
- Categorizing news articles
- Writing analysis results to a CSV file
-
This script focuses on extracting news article URLs from a specified source using web scraping techniques.
The project requires the following Python libraries:
-
Clone this repository to your local machine:
git clone https://github.com/your-username/news-analyzer.git
-
Navigate to the project directory:
cd news-analyzer
-
Install the required Python libraries:
pip install -r requirements.txt
-
Set your PALM API key in the newsanalyzer.py script:
PALM_API_KEY = "YOUR_API_KEY"
To run the News Analyzer, execute the main.py script
python main.py
This will extract URLs and save in the news_url_list.csv
file, analyze the news articles, and save the results in a new CSV file named result.csv
.
This project was developed using the following resources:
This project is intended for research purposes and may not be suitable for production environments. The analysis results should not be considered as financial or legal advice.