A comprehensive AI-powered system for analyzing news articles to determine credibility, emotional tone, and provide intelligent summaries. Built with cutting-edge NLP models and a robust credibility scoring algorithm.
- π Credibility Scoring: Multi-factor analysis combining source reputation with content quality indicators
- π€ AI Summarization: BART model generates concise, intelligent summaries
- π Emotion Detection: RoBERTa model analyzes emotional tone (positive/negative/neutral)
- π·οΈ Smart Web Scraping: Dual-layer extraction using newspaper3k + BeautifulSoup
- π Visual Analytics: Interactive charts and comprehensive breakdowns
- 50+ News Sources: Pre-rated credibility database covering major outlets
- Tier System: 4-tier credibility classification (Highly Credible to Mixed)
- Regular Updates: Continuously updated source reputation scores
- Coverage: Reuters, BBC, CNN, Fox News, NYT, WSJ, and many more
- Backend: Python + Flask
- AI Models:
- BART (facebook/bart-large-cnn) for summarization
- RoBERTa (cardiffnlp/twitter-roberta-base-emotion) for emotion detection
- Web Scraping: newspaper3k + BeautifulSoup4
- Frontend: HTML5 + CSS3 + JavaScript + Chart.js
- Data Processing: NumPy, NLTK, transformers
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Web Scraper βββββΆβ AI Analyzer βββββΆβ Credibility β
β β β β β Scorer β
β β’ newspaper3k β β β’ BART Summary β β β
β β’ BeautifulSoup β β β’ RoBERTa Emotionβ β β’ Source DB β
β β’ Fallback β β β’ Fallbacks β β β’ Content Eval β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Python 3.8+
- 4GB+ RAM (for AI models)
- Internet connection (for web scraping)
# Clone the repository
git clone <repository-url>
cd veritas
# Install dependencies
pip install -r requirements.txt
# Download required NLTK data (first time only)
python -c "import nltk; nltk.download('punkt')"
# Run the application
python app.py# Optional: Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install requirements
pip install -r requirements.txt- Start the application:
python app.py - Open browser to
http://localhost:5000 - Enter a news article URL
- Get comprehensive analysis in seconds
POST /api/analyze
Content-Type: application/json
{
"url": "https://example.com/news-article"
}{
"article": {
"title": "Article Title",
"source_domain": "example.com",
"url": "https://example.com/news-article",
"content_preview": "Article preview..."
},
"analysis": {
"credibility": {
"final_score": 85.2,
"confidence": 0.87,
"interpretation": {
"level": "High Credibility",
"description": "Reliable source with good practices"
},
"breakdown": {
"source_reputation": {"score": 12.6, "source_name": "BBC"},
"article_length": {"score": 10, "word_count": 800},
"citations": {"score": 9, "citation_count": 3}
}
},
"emotion": {
"emotion": "neutral",
"confidence": 0.82,
"method": "roberta_ai"
},
"summary": "AI-generated article summary..."
}
}GET /api/sources| Factor | Weight | Description |
|---|---|---|
| Base Score | 50% | Neutral starting point |
| Source Reputation | Β±30% | Known source credibility rating |
| Article Length | Β±10% | Comprehensive vs. brief coverage |
| Citations | +15% | Source attribution indicators |
| Factual Content | +10% | Data, numbers, official references |
| Emotional Language | -10% | Penalty for sensational wording |
- Tier 1 (85-95%): Reuters, BBC, AP, NPR, PBS
- Tier 2 (75-85%): NYT, WashPost, WSJ, Guardian, Economist
- Tier 3 (65-75%): CNN, NBC, ABC, CBS, Time
- Tier 4 (55-65%): Fox News, MSNBC, NY Post, HuffPost
- Citations: "according to", "study shows", "expert says"
- Facts: dates, percentages, official names, statistics
- Length: 500+ words indicates thorough coverage
- Emotional words: "shocking", "unbelievable", "outrageous"
- Brief articles: <200 words suggests incomplete coverage
- Missing sources: claims without attribution
URL: https://bbc.com/news/climate-change-study
Credibility Score: 84.6%
βββ Base Score: +50.0%
βββ Source (BBC): +12.6%
βββ Length (800 words): +10.0%
βββ Citations (3 found): +9.0%
βββ Facts (5 indicators): +5.0%
βββ Emotional (-1 word): -2.0%
Emotion: Neutral (82% confidence)
Summary: "Climate researchers report significant temperature increases..."
# Optional configurations
export SECRET_KEY="your-secret-key"
export DEBUG=False
export PORT=5000Models are loaded automatically on first use. For custom configurations:
# In modules/ai_analyzer.py
self.summarizer = pipeline(
"summarization",
model="facebook/bart-large-cnn", # Change model here
device=0 if torch.cuda.is_available() else -1
)| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Main web interface |
POST |
/api/analyze |
Analyze news article |
GET |
/api/sources |
Get source database |
GET |
/api/health |
Health check |
All endpoints return structured error responses:
{
"error": "Description of error",
"code": 400,
"timestamp": "2026-01-07T12:00:00Z"
}# Test with a known article
curl -X POST http://localhost:5000/api/analyze \
-H "Content-Type: application/json" \
-d '{"url": "https://www.bbc.com/news"}'# Check health endpoint
curl http://localhost:5000/api/healthQuickly assess the credibility of news articles shared on social media
Help students understand credibility indicators in journalism
Verify source quality for academic or professional research
Filter high-quality articles for news aggregation platforms
- β Real-time fact-checking of specific claims
- β Political bias assessment (we focus on factual accuracy)
- β Individual journalist reputation tracking
- β Content verification against external databases
- AI models require significant RAM (4GB+ recommended)
- Some websites may block automated scraping
- Summarization quality varies with article complexity
- Emotion detection trained primarily on English text
- No Storage: Articles are processed in memory only
- No Tracking: No user behavior or article analysis stored
- Respectful Scraping: Implements delays and respects robots.txt
- Tool is designed to supplement, not replace, critical thinking
- Source database aims for objectivity but reflects editorial choices
- Results should be considered alongside other verification methods
# Install development dependencies
pip install pytest black flake8
# Run tests
pytest
# Format code
black modules/ *.py
# Lint code
flake8 modules/ *.pyUpdate modules/source_database.py:
new_sources = {
'example.com': {
'name': 'Example News',
'credibility': 75,
'tier': 3,
'description': 'Regional news outlet'
}
}- Model Loading Errors: Ensure 4GB+ RAM available
- Scraping Failures: Some sites block automated access
- Slow Performance: First AI model load takes time
- Check the logs for detailed error messages
- Ensure all requirements are properly installed
- Verify internet connectivity for both scraping and model downloads
This project is licensed under the MIT License - see the LICENSE file for details.
- Hugging Face for BART and RoBERTa models
- newspaper3k for news extraction capabilities
- Chart.js for visualization components
- Media research organizations for credibility benchmarks
Veritas - "Truth through Analysis"
Built for journalists, researchers, educators, and anyone who values informed decision-making in our information age.