This README contains all the necessary info about the project. Scroll down to the "Getting Started" section to see how to add it to your Chrome browser.
Watch a video demonstration of the project: Click Here
Darpan (दर्पण), the Sanskrit word for "Mirror," is a powerful analysis engine designed to reflect the true nature of online content. In an era where digital discourse is often clouded by toxicity, misinformation, and hate, Project Darpan serves as a mirror, exposing harmful patterns that undermine constructive conversation.
This tool provides an objective, pattern-based analysis to identify and score various forms of negative content, from subtle propaganda tactics to overt hate speech. By holding a mirror to the text, we aim to empower developers, moderators, and researchers to build healthier and safer online communities.
The digital public square is increasingly polluted with:
- Separatist and Anti-National Rhetoric that threatens national integrity.
- Hate Speech and Communal Incitement that divides communities.
- Geopolitical Disinformation that spreads false narratives.
- Attacks on Institutions that erode public trust.
- Subtle Propaganda Tactics that manipulate public opinion.
Moderating this content manually is unsustainable. Project Darpan offers an automated, scalable solution to identify and categorize these toxic patterns effectively.
- Toxicity Scoring: Each piece of text is assigned a cumulative "Toxicity Score" based on the severity and frequency of detected patterns.
- Detailed Categorization: Content is analyzed and flagged under specific categories of toxicity for granular insight.
- Pattern-Based Detection: Utilizes a comprehensive and expanding library of keywords, regular expressions, and linguistic patterns.
- Context-Aware: The patterns are curated with a focus on the socio-political context of the Indian digital landscape.
- Extensible Framework: The toxicPatterns object can be easily updated to include new keywords, patterns, and categories as online discourse evolves.
Project Darpan operates on a weighted pattern-matching system. The core logic iterates through a predefined set of toxic patterns:
- Ingestion: The tool takes raw text as input.
- Keyword Analysis: It scans the text for keywords associated with various toxic categories (e.g.,
separatist,hate_speech,military_disinfo). - Regex Pattern Matching: It applies regular expressions to identify manipulative tactics, such as excessive capitalization, whataboutism, or conspiracy theory terminology.
- Scoring & Aggregation: When a pattern is matched, its corresponding score is added to a running total. The system also logs which specific patterns were triggered.
- Output: The final output is a JSON object containing the total toxicity score and a breakdown of all the detected issues and their categories.
The engine currently identifies and scores content across several major categories, including:
- Separatist & Anti-National Rhetoric
- Casteist Abuse
- Misogyny & Gender-Based Abuse
- Hate Speech & Communal Incitement
- Military & Security Forces Disinformation
- Geopolitical Disinformation
- Institutional Attacks & Distrust
- General Negativity & Demoralization
- Propaganda Tactics & Manipulation
You can use Project Darpan either as a Node.js module in your own projects or directly in your browser as a Chrome Extension.
Follow these steps to load the extension into your Chrome browser:
-
Download the Project:
- Clone the repository to your local machine:
git clone https://github.com/your-username/project-darpan.git
- Alternatively, you can download the project as a ZIP file and extract it.
- Generate your Hugging Face API key and replace it with (apiKey: "your-huggingface-api-key-here") in popup.js.
- Clone the repository to your local machine:
-
Open Chrome Extensions Page:
- Launch Google Chrome.
- Navigate to
chrome://extensionsin your address bar.
-
Enable Developer Mode:
- In the top-right corner of the Extensions page, find and turn on the Developer mode toggle. This will reveal a new menu bar.
-
Load the Extension:
- Click the "Load unpacked" button that appears on the top-left.
- A file selection window will open. Navigate to and select the entire
project-darpanfolder that you cloned or unzipped. - Click "Select Folder".
-
Ready to Go!:
- Project Darpan will now appear in your list of extensions. Ensure it's enabled with the toggle switch. The extension is now active and will analyze content as you browse.
Contributions are welcome! If you wish to improve Project Darpan, please feel free to fork the repository, make your changes, and submit a pull request. You can contribute by:
- Adding new keywords to existing categories.
- Creating new categories of toxic behavior.
- Improving the regular expressions for pattern matching.
- Enhancing the scoring algorithm.