{"id":27073100,"url":"https://github.com/aicodecraft/anti-dump-algorithm","last_synced_at":"2025-04-05T23:42:44.954Z","repository":{"id":274245553,"uuid":"917199593","full_name":"AiCodeCraft/Anti-Dump-Algorithm","owner":"AiCodeCraft","description":"The Anti-Dump Algorithm is designed to evaluate and filter out unproductive or irrelevant input, commonly referred to as \"noise,\" while prioritizing clarity, effort, and context. This algorithm measures the quality of input based on several key parameters with the ADI.","archived":false,"fork":false,"pushed_at":"2025-03-30T19:48:17.000Z","size":1589,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T05:46:39.281Z","etag":null,"topics":["ai","ai-algorithm","ai-solutions","algorithm","algorithm-challenges","algorithms-and-data-structures","anti-dump","anti-dump-algorithm","dump","dumper","dumpiness","python","solutions","spam-filtering"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AiCodeCraft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["volkansah"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"volkansah","thanks_dev":null,"custom":null}},"created_at":"2025-01-15T14:45:48.000Z","updated_at":"2025-03-30T19:48:21.000Z","dependencies_parsed_at":"2025-01-30T07:49:22.485Z","dependency_job_id":null,"html_url":"https://github.com/AiCodeCraft/Anti-Dump-Algorithm","commit_stats":null,"previous_names":["aicodecraft/anti-dump-algorithm","volkansah/anti-dump-algorithm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiCodeCraft%2FAnti-Dump-Algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiCodeCraft%2FAnti-Dump-Algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiCodeCraft%2FAnti-Dump-Algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiCodeCraft%2FAnti-Dump-Algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AiCodeCraft","download_url":"https://codeload.github.com/AiCodeCraft/Anti-Dump-Algorithm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415925,"owners_count":20935385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-algorithm","ai-solutions","algorithm","algorithm-challenges","algorithms-and-data-structures","anti-dump","anti-dump-algorithm","dump","dumper","dumpiness","python","solutions","spam-filtering"],"created_at":"2025-04-05T23:42:44.263Z","updated_at":"2025-04-05T23:42:44.942Z","avatar_url":"https://github.com/AiCodeCraft.png","language":"Python","readme":"# Anti-Dump Algorithm (ADI)\n\n\u003e **Weeding out the nonsense and fostering clarity.**  \n\u003e _We measure the “Dumpiness” of an input by quantifying Noise vs. Effort, Context, and Details._ 😅\n\n![ADI ANti-Dump-Index](adi.png)\n\nIf you develop AI tools, you’ve probably encountered how surprisingly unproductive or nonsensical some human input can be. These \"dumpy\" requests waste both time and money! After extensive testing, I realized that filtering such input was no easy task. Large Language Models (LLMs) often provide answers to even the most irrelevant or unclear queries. \n\n-\u003e **So, I thought: why not solve this problem with math? And that’s exactly what happened!**\n\n## Purpose\nThe **Anti-Dump Algorithm** calculates the **ADI (Anti-Dump Index)**. It is specifically designed to evaluate and filter out unproductive or irrelevant input—commonly referred to as \"noise\"—while prioritizing clarity, effort, and context. This algorithm measures the quality of input based on several key parameters, ensuring only meaningful contributions are processed.\n\n#### How to calculate Anti-Dump-Index (ADI)\n\n$$\nADI = \\frac{w_N \\cdot \\text{Noise} - (w_E \\cdot \\text{Effort} + w_B \\cdot \\text{BonusFactors})}{w_C \\cdot \\text{Context} + w_D \\cdot \\text{Details} + w_P \\cdot \\text{PenaltyFactors}}\n$$\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eTable of Contents\u003c/strong\u003e\u003c/summary\u003e\n\n1. [Introduction \u0026 Core Idea](#1-introduction--core-idea)  \n2. [Basic Formula: DumpIndex](#2-basic-formula-dumpindex)  \n3. [Zones \u0026 Visual Representation](#3-zones--visual-representation)  \n4. [Extension: Dumpiness Gradient](#4-extension-dumpiness-gradient)  \n5. [Advanced Factors \u0026 Global Anti-Dump Index (ADI)](#5-advanced-factors--global-anti-dump-index-adi)  \n6. [Examples \u0026 Edge Cases](#6-examples--edge-cases)  \n7. [Extended Logic](#7-extended-logic)  \n8. [Applications](#8-applications)  \n9. [AI Integration \u0026 Workflow](#9-ai-integration--workflow)  \n10. [Example Code (Sketch)](#10-example-code-sketch)  \n11. [Conclusion](#11-conclusion)  \n12. [License \u0026 Acknowledgments](#12-license--acknowledgments)\n13. [How to use](HOW-TO-USE.md)\n\n\n\u003c/details\u003e\n\n\n## 1. Introduction \u0026 Core Idea\n\n### Background\nIf you run AI tools, forums, or support systems, you know the problem:  \n- Many requests are vague (\"Help plz urgent asap!!!\").  \n- Essential details (error messages, code snippets, versions) are missing.  \n\nTo mathematically identify **dumpiness** (noise in a request), I introduced a **scoring system** into my applications that calculates the **quality** of an input. This quality score is called the **Anti-Dump Index (ADI)**, also known as **DumpIndex** in simpler terms.\n\n### Core Idea\n1. **Identify Noise**  \n2. **Measure Effort and Details**  \n3. **Evaluate Context**  \n\nGoal: **Reject inputs** with high noise and low content or ask the user for **improvements**, while **prioritizing** solid contributions.\n\n\n## 2. Basic Formula: DumpIndex\n\nThe **simple** version of the algorithm is defined by the **DumpIndex**:\n\n$$\n\\text{DumpIndex} = \\frac{\\text{Noise} \\;-\\; \\text{Effort}}{\\text{Context} + \\text{Details}}\n$$\n\n- {Noise}: Proportion of irrelevant words/phrases (e.g., \"pls fix,\" \"ASAP,\" \"???\").  \n- {Effort}: Clarity and structure (meaningful keywords, sentences, formatting).  \n- {Context}: Reference to OS, framework, environment, etc.  \n- {Details}: Depth of technical information (error messages, code snippets).  \n\n**Interpretation**:  \n- **High DumpIndex** \\(\\Rightarrow\\) High dumpiness, lots of noise, little effort.  \n- **Low DumpIndex** (below 0) \\(\\Rightarrow\\) Good contribution, worth addressing.  \n\n### Example Calculation (Basic)\n1. **Input**: _\"Pls fix my code, urgent!\"_  \n   - Noise: 3/4 = 0.75  \n   - Effort: 1  \n   - Context: 0  \n   - Details: 0  \n\n$$\n\\text{DumpIndex} = \\frac{0.75 - 1}{0 + 0} = \\infty \\quad(\\text{Pure Dumpiness Detected})\n$$\n\n2. **Input**: _\"Error: 'KeyError' in Python. Occurs when accessing a dictionary with missing key.\"_  \n   - Noise: 0 (no filler words)  \n   - Effort: 3 (clear \u0026 structured)  \n   - Context: 2 (Python, Dictionary)  \n   - Details: 1 (specific error)  \n\n$$\n\\text{DumpIndex} = \\frac{0 - 3}{2 + 1} = -1 \\quad(\\text{Qualified Contribution})\n$$\n\n\n## 3. Zones \u0026 Visual Representation\n\n- **DumpZone**: \\(\\text{DumpIndex} \u003e 1\n- **GrayArea**: 0 ≤ {DumpIndex} ≤  1 \n- **GeniusZone**: DumpIndex} \u003c 0\n\nThe values can be **graphically represented** in a chart to quickly identify whether a request lands in the \"Dump Zone\" or \"Genius Zone.\"\n\n\n## 4. Extension: Dumpiness Gradient\n\nTo understand **how** sensitive the DumpIndex is to changes in Noise and Effort, we define a **Gradient**:\n\n$$\n\\text{Gradient} = \\frac{\\partial (\\text{DumpIndex})}{\\partial (\\text{Noise}, \\text{Effort})}\n$$\n\nThis allows on-the-fly evaluation of inputs and shows how much a small increase in Noise worsens the result (or how much Effort saves it).\n\n\n## 5. Advanced Factors \u0026 Global Anti-Dump Index (ADI)\n\nTo incorporate additional aspects—such as **bonus and penalty points**—we developed the **global formula**:\n\n$$\nADI = \\frac{w_N \\cdot \\text{Noise} - (w_E \\cdot \\text{Effort} + w_B \\cdot \\text{BonusFactors})}{w_C \\cdot \\text{Context} + w_D \\cdot \\text{Details} + w_P \\cdot \\text{PenaltyFactors}}\n$$\n\n\n**Parameters**:\n1. {Noise}\\\n2. {Effort}\n3. {Context}\n4. {Details}\n5. {BonusFactors}: Points for clean structure, accurate terms, code blocks.  \n6. {PenaltyFactors}: Deductions for ALL CAPS, irrelevant jargon, overuse of \"!!!\" etc.  \n\n**Weighting Factors**: \\(w_N, w_E, w_C, w_D, w_B, w_P\\)  \n- Allow **fine-tuning** (e.g., support systems vs. general forums).\n\n**Interpretation**:  \n- **ADI \u003e 1**: Reject input, ask for revision.\n- **0 ≤ ADI ≤ 1**: Medium-priority input.\n- **ADI \u003c 0**: High-quality input, prioritize response.\n\n\n## 6. Examples \u0026 Edge Cases\n\n### 6.1 Disaster\n\u003e _\"Help plssss! My code doesn’t work. Fix it! ASAP!!!\"_\n\n- **Noise** = 4/8 = 0.5  \n- **Effort** = 0  \n- **Context** = 0  \n- **Details** = 0  \n\n$$\n\\text{DumpIndex} = \\frac{0.5 - 0}{0 + 0} = \\infty \\quad(\\text{Complete Disaster})\n$$\n\n### 6.2 Half-Decent\n\n\u003e _\"My Python script throws a KeyError. I don't know how to fix it.\"_\n\n- **Noise** = 0  \n- **Effort** = 1  \n- **Context** = 1  \n- **Details** = 0  \n\n$$\n\\text{DumpIndex} = \\frac{0 - 1}{1 + 0} = -1 \\quad(\\text{Solid, but lacks details})\n$$\n\n### 6.3 Exemplary\n\n\u003e _\"I get a ‘KeyError’ in Python when accessing a dictionary with a missing key. Here’s the code: …\"_\n\n- **Noise** = 0  \n- **Effort** = 2  \n- **Context** = 2  \n- **Details** = 1  \n\n$$\n\\text{DumpIndex} = \\frac{0 - 2}{2 + 1} = -0.67 \\quad(\\text{Perfect Contribution})\n$$\n\n\n## 7. Extended Logic\n\n### 7.1 Error Tolerance \u0026 Typos\n- Not every flood of typos should drastically increase the Noise value.  \n- Above a certain threshold (\u003e10%), it may indicate negligence.  \n\n$$\n\\text{Noise}_{\\text{Typos}} = \\frac{\\text{Incorrect Words}}{\\text{Total Words}}\n$$\n```\ndef calculate_typos(self, text: str) -\u003e float:\n    \"\"\"\n    Berechnet den Anteil von Tippfehlern im Text und passt den Noise-Wert basierend auf der Fehlerquote an.\n    \"\"\"\n    words = text.split()\n    total_words = len(words)\n    \n    # Pseudo-Wörter, die wahrscheinlich Tippfehler sind (z. B. häufige Tippfehler, einfache Wortlisten)\n    typo_pattern = r'\\b[a-zA-Z]{1,2}\\b|\\b[^\\s]+[^a-zA-Z0-9\\s]+\\b'\n    typos = len(re.findall(typo_pattern, text))\n    \n    typo_percentage = typos / max(total_words, 1)\n    \n    # Wenn die Tippfehlerquote mehr als 10 % beträgt, wird dies als potenziell nachlässig gewertet\n    return typo_percentage\n\n```\n### 7.2 Profiling Index (Pseudo-Competence)\nIdentifies inputs that sound fancy but lack substance:\n\n$$\n\\text{Profiling Index} = \\frac{\\text{PseudoTerms} + \\text{Noise}}{\\text{Effort} + \\text{Details}}\n$$\n\n```\ndef calculate_profiling_index(self, text: str) -\u003e float:\n    \"\"\"\n    Berechnet den Profiling-Index, der Inputs bewertet, die auf den ersten Blick kompetent klingen, aber keine substanzielle Information bieten.\n    \"\"\"\n    # Beispielhafte Pseudo-Terme, die als \"fancy\" aber wenig substantiell gelten\n    pseudo_terms = r'\\b(optimal|synergy|innovative|disruptive|synergize)\\b'\n    pseudo_matches = len(re.findall(pseudo_terms, text.lower()))\n    \n    # Profiling-Index ist eine Kombination aus Pseudo-Begriffen, Noise, Effort und Details\n    noise_value, _ = self.calculate_noise(text)\n    effort_value = self.calculate_effort(text)\n    details_value, _ = self.calculate_details(text)\n    \n    profiling_index = (pseudo_matches + noise_value * effort_value + details_value)\n    \n    return profiling_index\n\n```\n\n### 7.3 Adjusted Noise Calculation\n\n$$\n\\text{Noise}_{\\text{Adjusted}} = \\text{Noise} \\cdot \\Bigl( 1 - \\frac{\\text{Details}}{\\text{Total Words}} \\Bigr)\n$$\n\n```\ndef calculate_adjusted_noise(self, text: str) -\u003e float:\n    \"\"\"\n    Berechnet den angepassten Noise-Wert, der Details und die Gesamtzahl der Wörter berücksichtigt.\n    \"\"\"\n    noise_value, _ = self.calculate_noise(text)\n    total_words = len(text.split())\n    details_value, _ = self.calculate_details(text)\n    \n    adjusted_noise = noise_value * (1 - details_value / max(total_words, 1))\n    \n    return adjusted_noise\n\n```\n\n### 7.4 Anti-Dump Score (Inverse)\n\n$$\n\\text{AntiDumpScore} = \\frac{\\text{Effort} + \\text{Context} + \\text{Details}}{\\text{Noise} + 1}\n$$\n\n```\ndef calculate_anti_dump_score(self, text: str) -\u003e float:\n    \"\"\"\n    Berechnet den Anti-Dump-Score (inverse), der die Effizienz und Substanz des Textes misst.\n    \"\"\"\n    effort_value = self.calculate_effort(text)\n    context_value = self.calculate_context(text)\n    details_value, _ = self.calculate_details(text)\n    noise_value = self.calculate_noise(text)[0]\n    \n    anti_dump_score = (effort_value + context_value + details_value) / (noise_value + 1)\n    \n    return anti_dump_score\n\n```\n\n\n## 8. Applications\n\n1. **Support Systems**  \n   - Filter poorly formulated tickets.  \n   - Automatic prompt: \"Please provide more details.\"\n2. **Education**  \n   - Scan essays: filler words vs. concrete facts.\n3. **HR \u0026 Recruitment**  \n   - Applications with high Noise scores -\u003e polite rejection.  \n4. **Online Forums**  \n   - Highlight poor questions, encourage user improvements.\n\n\n## 9. AI Integration \u0026 Workflow\n\n1. **Preprocessing**  \n   - Analyze text, determine metrics\n\n$$   \n\\(\\text{Noise}, \\text{Effort}, \\ldots\\).\n$$\n\n1. **ADI Calculation**  \n   - Use the global formula with weights.  \n2. **Decision**  \n   - ADI \u003e 1: Reject request.  \n   - 0 \\leq ADI \\leq 1: Medium priority.  \n   - ADI \u003c 0: Prioritize, high quality.  \n3. **Feedback Loop**  \n   - User or team feedback adjusts weightings.\n\n\n## 10. Example Code (Sketch)\n\n*(For demonstration only – not production-ready.)*\n\n```python\ndef calculate_adi(noise, effort, context, details, bonus, penalty, weights):\n    w_N, w_E, w_C, w_D, w_B, w_P = weights\n    try:\n        numerator = w_N * noise - (w_E * effort + w_B * bonus)\n        denominator = w_C * context + w_D * details + w_P * penalty\n        return numerator / max(denominator, 0.1)  # Avoid div/0\n    except ZeroDivisionError:\n        return float('inf')\n\n# Example Test\ninput_text = \"Pls fix my code. Urgent!!!\"\nweights = (1.0, 2.0, 1.5, 1.5, 0.5, 1.0)  # (w_N, w_E, w_C, w_D, w_B, w_P)\n\n# Assumed values (for demo):\nnoise_val = 0.5\neffort_val = 0\ncontext_val = 0\ndetails_val = 0\nbonus_val = 0\npenalty_val = 1.0\n\nadi_value = calculate_adi(\n    noise_val, effort_val, context_val, details_val,\n    bonus_val, penalty_val, weights\n)\n\nif adi_value \u003e 1:\n    print(\"Reject. Please revise.\")\nelif 0 \u003c= adi_value \u003c= 1:\n    print(\"Mediocre input.\")\nelse:\n    print(\"Very good input!\")\n```\n\n---\n\n\n\n## 11. Conclusion\n\nThe **Anti-Dump Algorithm** provides a **robust mathematical foundation** for evaluating input quality, is **easily extendable**, and can be adapted to **various domains**:\n\n- **DumpIndex** or **ADI** \u003e 1: Low effort, irrelevant information.  \n- **ADI** \u003c 0: Well-structured, clearly formulated requests.  \n\nThis tool saves **time** and **resources** while fostering **better questions** and **more constructive discussions**. Simply put, ADI can optimize your tools and educate your users with AI technology!\n\n\u003e **Fun Fact**: While not Nobel-worthy, every LLM confronted with this method showed improved interactions and educated users. This is my gift to anyone tired of nonsense—let’s make this a standard! 😅 I’d appreciate a ⭐ or even a ☕ if you find it helpful. 😄\n\n\n## 12. License \u0026 Acknowledgments\n\n- This document and example code are licensed under a **Public license** \n- Thanks to all dumpy ai-website users!  Realy , real thanks stupid dumps! From funfact to real solution!\n\n#### Copyright\n[S. Volkan Kücükbudak](https://github.com/volkansah)\n\n**Stay Dump-Free!**\n","funding_links":["https://github.com/sponsors/volkansah","https://buymeacoffee.com/volkansah"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faicodecraft%2Fanti-dump-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faicodecraft%2Fanti-dump-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faicodecraft%2Fanti-dump-algorithm/lists"}