Skip to content

ray-rada/news-framing-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News Framing Analyzer

A web application that analyzes how news articles frame events through language choices, source selection, and emphasis patterns. The tool searches for articles on a given topic, extracts their content, and uses AI to identify framing signals including evaluative language, agent emphasis, quoted sources, causal framing, and headline framing.

Features

  • Article Discovery: Automatically finds relevant news articles using Google Custom Search API
  • Content Extraction: Scrapes article content, headlines, authors, and publication dates
  • Framing Analysis: Uses Google Gemini AI to analyze articles across 5 key framing dimensions:
    • Evaluative language
    • Agent emphasis
    • Quoted sources
    • Causal framing
    • Headline framing
  • Modern Web Interface: Clean, responsive frontend built with Tailwind CSS

Tech Stack

  • Backend: Flask (Python)
  • Frontend: HTML, CSS, JavaScript (Tailwind CSS)
  • APIs: Google Gemini AI, Google Custom Search API
  • Web Scraping: newspaper3k, BeautifulSoup

Prerequisites

  • Python 3.7+
  • Google Gemini API key
  • Google Custom Search API key and Engine ID

Setup

  1. Clone the repository

    git clone <your-repo-url>
    cd news-framing-tool
  2. Install dependencies

    cd backend
    pip install -r requirements.txt
  3. Configure environment variables

    Create a .env file in the project root:

    GEMINI_API_KEY=your_gemini_api_key
    GOOGLE_SEARCH_API_KEY=your_google_search_api_key
    GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id
    
  4. Run the backend server

    cd backend
    python app.py

    The API will run on http://localhost:5000

  5. Open the frontend

    Open frontend/index.html in your web browser, or serve it using a local web server.

Usage

  1. Enter a news topic in the search box (e.g., "2024 Paris Olympics opening ceremony")
  2. Click "Analyze Framing" to search for articles and analyze their framing
  3. View detailed framing analysis results for each article

API Endpoints

  • GET /api/health - Health check endpoint
  • POST /api/analyze - Analyze framing for a topic
    {
      "topic": "2024 Paris Olympics opening ceremony"
    }

Project Structure

news-framing-tool/
├── backend/
│   ├── app.py                 # Flask application
│   ├── config.py              # Configuration and API key management
│   ├── requirements.txt       # Python dependencies
│   ├── services/
│   │   ├── article_finder.py  # Google Search integration
│   │   ├── scraper.py         # Article content extraction
│   │   └── analyzer.py        # Gemini AI framing analysis
│   └── utils/
│       └── prompts.py         # AI prompts for analysis
├── frontend/
│   ├── index.html            # Main search interface
│   ├── results.html          # Results display page
│   ├── script.js             # Frontend JavaScript
│   └── style.css             # Custom styles
└── README.md

Disclaimer

This tool analyzes how articles frame events through language choices. It does not fact-check content or determine which framing is more accurate. The analysis is meant to help users understand different perspectives and framing techniques used in news media.

License

[Add your license here]

About

News Framing Analyzer - A web application that analyzes how news articles frame events through language choices, source selection, and emphasis patterns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors