sakshamwadhankar21/truthlens-backend
0
TruthLens ๐
Advanced Real-Time Fake News Detection & Verification System
TruthLens (formerly News Guardian) is a robust web application designed to combat misinformation. It leverages advanced Web Scraping, Natural Language Processing (NLP), and Machine Learning to verify news claims in real-time by cross-references them against credible sources on the live internet.
๐ Key Features
- Real-Time Verification: Instantly verifies claims by searching the live web using DuckDuckGo.
- Intelligent Scraping: Robustly extracts content from diverse news sources, handling partial data and anti-bot measures.
- AI-Powered Analysis:
- Semantic Similarity: Uses
SpaCyandSentence-Transformersto compare claims with gathered evidence. - Summarization: Automatically condenses long articles into digestible summaries using LSA.
- Zero-Shot Classification: Detects hate speech, profanity, and other harmful content patterns.
- Visual Context: Generates dynamic WordClouds to visualize the key themes of the verified news.
- Graceful Degradation: Smart fallback logic ensures users get results even if some data sources fail.
๐ ๏ธ Technology Stack
๐๏ธ Architecture
TruthLens follows a clean Service-Oriented Architecture within the standard Django MVT pattern:
- Service Layer (`facts/services.py`): Encapsulates all complex business logic (Search, Scrape, NLP, Verification). This ensures the views remain lightweight and the logic is reusable.
- Controller (`facts/views.py`): Handles HTTP requests, orchestrates the service calls, and manages the data flow to the template.
- Prototypes (`research_prototypes/`): Contains isolated scripts for debugging and testing the search/scrape pipeline independently.
๐ป Installation & Usage
Prerequisites
- Python 3.10 or higher
- Git
1. Clone the Repository
git clone https://github.com/sakshamwadhankar/-EV55_Desync.git
cd -EV55_Desync2. Install Dependencies
It is recommended to use a virtual environment.
pip install -r requirements.txt
python -m spacy download en_core_web_md3. Run Migrations
python manage.py migrate4. Start the Server
python manage.py runserverAccess the application at `http://127.0.0.1:8000/`
๐ How it Works
- Input: User enters a news headline or claim (e.g., "India is under world war").
- Search: The system queries DuckDuckGo for relevant, recent articles.
- Process:
- Top URLs are scrapped for content.
- Text is filtered, cleaned, and summarized.
- Verify:
- Cosine similarity checks alignment between the claim and the evidence.
- Safety classifiers check for hate speech or profanity.
- Result: The user receives a True/Fake verdict, a confidence summary, source links, and a context word cloud.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is open-source and available under the MIT License.
