8000 GitHub - abg0148/msft_hackathon: doing some sentiment analysis stuff · GitHub
[go: up one dir, main page]

Skip to content

About

doing some sentiment analysis stuff

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

News Sentiment Analysis ETL Pipeline

A real-time news sentiment analysis ETL pipeline built with Pathway, designed to fetch, process, and analyze news articles for sentiment insights.

Features

  • Real-time Processing: Stream-based processing using Pathway
  • Multiple Data Sources: Support for NewsAPI and RSS feeds
  • Advanced Sentiment Analysis: Using both TextBlob and Transformers models
  • Flexible Output: Store results in various formats (JSON, CSV, database)
  • Scalable Architecture: Built for high-throughput processing

Quick Start

  1. Install Dependencies:

    pip install -r requirements.txt
  2. Set up Environment Variables:

    cp .env.example .env
    # Edit .env with your API keys
  3. Run the Pipeline:

    python main.py

Project Structure

├── main.py                 # Main pipeline entry point
├── src/
│   ├── data_sources/       # News data source connectors
│   ├── processors/         # Data processing and transformation
│   ├── sentiment/          # Sentiment analysis modules
│   └── outputs/            # Output handlers
├── config/
│   └── settings.py         # Configuration settings
├── tests/                  # Unit tests
└── data/                   # Output data storage

Configuration

The pipeline can be configured through environment variables or the config/settings.py file:

  • NEWS_API_KEY: Your NewsAPI key
  • SENTIMENT_MODEL: Choice of sentiment model (textblob/transformers)
  • OUTPUT_FORMAT: Output format (json/csv/database)
  • BATCH_SIZE: Processing batch size
  • UPDATE_INTERVAL: How often to fetch new data

Usage Examples

Basic Usage

from main import NewsSentimentPipeline

pipeline = NewsSentimentPipeline()
pipeline.run()

Custom Configuration

from main import NewsSentimentPipeline
from config.settings import Settings

settings = Settings(
    news_api_key="your_key",
    sentiment_model="transformers",
    output_format="json"
)
pipeline = NewsSentimentPipeline(settings)
pipeline.run()

Output Format

The pipeline outputs sentiment analysis results in the following format:

{
    "article_id": "unique_id",
    "title": "Article Title",
    "content": "Article content...",
    "source": "news_source",
    "published_at": "2024-01-01T00:00:00Z",
    "sentiment_score": 0.75,
    "sentiment_label": "positive",
    "confidence": 0.92,
    "processed_at": "2024-01-01T00:00:00Z"
}

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License

About

doing some sentiment analysis stuff

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0