{"id":25255009,"url":"https://github.com/volkansah/anti-dump-algorithm","last_synced_at":"2025-08-31T19:03:34.766Z","repository":{"id":274245553,"uuid":"917199593","full_name":"VolkanSah/Anti-Dump-Algorithm","owner":"VolkanSah","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-08-19T14:03:47.000Z","size":3634,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"2025-patch-2","last_synced_at":"2025-08-29T12:49:23.553Z","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/VolkanSah.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,"zenodo":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-08-19T14:13:55.000Z","dependencies_parsed_at":"2025-08-18T17:53:49.396Z","dependency_job_id":"91a1cafc-ea91-4a31-a52b-fb48e9b52a98","html_url":"https://github.com/VolkanSah/Anti-Dump-Algorithm","commit_stats":null,"previous_names":["aicodecraft/anti-dump-algorithm","volkansah/anti-dump-algorithm"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/VolkanSah/Anti-Dump-Algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FAnti-Dump-Algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FAnti-Dump-Algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FAnti-Dump-Algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FAnti-Dump-Algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VolkanSah","download_url":"https://codeload.github.com/VolkanSah/Anti-Dump-Algorithm/tar.gz/refs/heads/2025-patch-2","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FAnti-Dump-Algorithm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273025829,"owners_count":25032842,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-02-12T05:51:24.417Z","updated_at":"2025-08-31T19:03:34.760Z","avatar_url":"https://github.com/VolkanSah.png","language":"Python","readme":"# Anti-Dump Algorithm (ADI)\n\n\u003e **Weeding out the nonsense and fostering clarity.**  \n\u003e *We measure \"Dumpiness\" by quantifying Noise vs. Effort, Context, and Details.* 😅\n\n![ADI Anti-Dump-Index](adi.png)\n\n\n## The Core Problem: Why My Wallet Started Crying\n\nWhen you're building an app with AI, you quickly learn a hard truth: people will send you all kinds of \"dumpy\" inputs. Vague, low-effort requests that cost you money because your expensive AI models still have to process them. It's the digital equivalent of someone shouting \"ASAP!!!\" at the bouncer. For me, this \"Dummheit\" (stupidity) started hitting my wallet directly, and I had to do something about it.\n\n## The Solution: My Digital 🇹🇷-Bouncer from Germany 😄\n\nInspired by my Turkish roots, I created a mathematical framework to act as a bouncer for my applications. This is the Anti-Dump Index (ADI). Its job is simple: check the quality of every single request at the door. If it's a good, high-quality request, it gets in. If it's \"dump\" – a waste of time and money – my bouncer has one simple rule:\n\n\"Ej, du kommst hier net rein!\"\n\nThis phrase, which roughly translates to \"Hey, you're not getting in here!\", is a legendary saying in Germany. It’s what you'd often hear from bouncers at nightclubs, particularly those with a Turkish background, and it's a nostalgic joke for anyone who grew up here.  It brings me joy to think of my code having its own bouncer to protect my developer wallet.\n\nThis project isn't a full app; it's a showcase for this logic. It's the technical manifestation of a developer's frustration, turned into a powerful, cost-saving solution.\n\n\n\n\n## Purpose\nThe **Anti-Dump Algorithm** calculates the **ADI (Anti-Dump Index)** to evaluate input quality by measuring:\n- **Noise**: Irrelevant content (e.g., \"URGENT!!!\", \"plz help\")\n- **Effort**: Clarity/structure\n- **Context**: Background information (OS, framework)\n- **Details**: Technical depth (error messages, code snippets)\n\n```math\nADI = \\frac{w_N \\cdot \\text{Noise} - (w_E \\cdot \\text{Effort} + w_B \\cdot \\text{Bonus})}{w_C \\cdot \\text{Context} + w_D \\cdot \\text{Details} + w_P \\cdot \\text{Penalty}}\n```\n\n### Key Parameters\n| Parameter | Description | Example |\n|-----------|-------------|---------|\n| **Noise** | Irrelevant words/phrases | \"ASAP\", \"???\" |\n| **Effort** | Structure/clarity | Complete sentences, formatting |\n| **Context** | Environment info | \"Python 3.9 on Windows\" |\n| **Details** | Technical specifics | Error logs, code snippets |\n| **Bonus** | Positive elements | Code blocks, precise terms |\n| **Penalty** | Negative elements | ALL CAPS, excessive \"!!!\" |\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eTable of Contents\u003c/strong\u003e\u003c/summary\u003e\n\n1. [Core Concepts](#1-core-concepts)  \n2. [Formula Explained](#2-formula-explained)  \n3. [Quality Zones](#3-quality-zones)  \n4. [Advanced Metrics](#4-advanced-metrics)  \n5. [Real-World Examples](#5-real-world-examples)  \n6. [Practical Implementation](#6-practical-implementation)  \n7. [Integration Guide](#7-integration-guide)  \n8. [Full Code](#8-full-code)  \n9. [Extended Logic](#9-extended-logic)  \n10. [FAQs](#10-faqs)  \n11. [License](#11-license)\n\u003c/details\u003e\n\n---\n\n## 1. Core Concepts\n\n### Why ADI Matters\n- **Vague requests** waste resources: \"Help plz urgent!!!\"\n- **Missing details** delay solutions (no error messages/code)\n- **AI costs** accumulate processing low-value input\n\n### How ADI Works\n1. **Quantify** input components (Noise, Effort, etc.)\n2. **Calculate** ADI score using weighted formula\n3. **Classify** into quality zones:\n   - 🟥 `ADI \u003e 1`: Reject (High dumpiness)\n   - 🟨 `0 ≤ ADI ≤ 1`: Medium priority\n   - 🟩 `ADI \u003c 0`: Prioritize (High quality)\n\n---\n\n## 2. Formula Explained\n\n### Base Formula (Simplified)\n```math\n\\text{ADI} = \\frac{\\text{Noise} - \\text{Effort}}{\\text{Context} + \\text{Details}}\n```\n\n### Full Formula (Weighted)\n```math\nADI = \\frac{w_N \\cdot \\text{Noise} - (w_E \\cdot \\text{Effort} + w_B \\cdot \\text{Bonus})}{w_C \\cdot \\text{Context} + w_D \\cdot \\text{Details} + w_P \\cdot \\text{Penalty}}\n```\n\n**Weights** customize for different use cases:\n```python\nweights = {\n    \"noise\": 1.0, \n    \"effort\": 2.0, \n    \"context\": 1.5,\n    \"details\": 1.5,\n    \"bonus\": 0.5,\n    \"penalty\": 1.0\n}\n```\n\n---\n\n## 3. Quality Zones\n![Quality Zones Diagram](zones.png)\n\n### Interpretation Guide\n| Zone | ADI Range | Action | Characteristics |\n|------|-----------|--------|-----------------|\n| **Dump Zone** | \u003e 1 | Reject | High noise, low effort, missing details |\n| **Gray Area** | 0-1 | Review | Partial context, some effort needed |\n| **Genius Zone** | \u003c 0 | Prioritize | Clear, contextualized, detailed |\n\n---\n\n## 4. Advanced Metrics\n\n### 4.1 Typo-Adjusted Noise\n```math\n\\text{Noise}_{\\text{adj}} = \\text{Noise} \\cdot (1 - \\frac{\\text{Details}}{\\text{Total Words}})\n```\n```python\ndef calculate_typos(text):\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    return typos / max(len(text.split()), 1)\n```\n\n### 4.2 Substance Score\nDetect \"fancy but empty\" inputs:\n```math\n\\text{Substance} = \\frac{\\text{Effort} + \\text{Details}}{\\text{Noise} + \\text{PseudoTerms} + 1}\n```\n\n### 4.3 Gradient Analysis\nMeasure sensitivity to improvements:\n```math\n\\nabla\\text{ADI} = \\frac{\\partial \\text{ADI}}{\\partial (\\text{Effort}, \\text{Details})}\n```\n\n---\n\n## 5. Real-World Examples\n\n### 5.1 Disaster Input\n\u003e *\"Help plssss! My code doesn't work. Fix it! ASAP!!!\"*\n\n```python\nnoise = 0.75   # 6/8 words irrelevant\neffort = 0.1    # No structure\ncontext = 0     # No environment info\ndetails = 0     # No technical details\n\nADI = (0.75 - 0.1) / (0 + 0) = ∞  # 🟥 Instant rejection\n```\n\n### 5.2 Medium Quality\n\u003e *\"Python script throws KeyError when accessing dictionary\"*\n\n```python\nnoise = 0.1    # Minimal filler\neffort = 0.8    # Clear statement\ncontext = 0.7   # Language specified\ndetails = 0.5   # Error type identified\n\nADI = (0.1 - 0.8) / (0.7 + 0.5) = -0.58  # 🟩 Good candidate\n```\n\n### 5.3 Perfect Input\n\u003e *\"Getting KeyError in Python 3.9 when accessing missing dictionary keys. Code example: `print(my_dict['missing'])`\"*\n\n```python\nnoise = 0.0     # No irrelevant words\neffort = 1.0    # Well-structured\ncontext = 1.0   # Python version specified\ndetails = 1.0   # Code example provided\nbonus = 0.5     # Code formatting\n\nADI = (0 - (2.0*1.0 + 0.5*0.5)) / (1.5*1.0 + 1.5*1.0) = -0.92  # 🟩 Prioritize\n```\n\n---\n\n## 6. Practical Implementation\n\n### Integration Workflow\n```mermaid\ngraph TD\n    A[User Input] --\u003e B(Preprocessing)\n    B --\u003e C[Metric Extraction]\n    C --\u003e D[ADI Calculation]\n    D --\u003e E{Decision}\n    E --\u003e|ADI \u003e 1| F[Reject + Feedback]\n    E --\u003e|0 ≤ ADI ≤ 1| G[Medium Priority]\n    E --\u003e|ADI \u003c 0| H[Prioritize + Process]\n```\n\n### Use Cases\n| Domain | Application |\n|--------|-------------|\n| **Support Systems** | Auto-filter low-quality tickets |\n| **Education** | Grade essay substance vs. fluff |\n| **Recruitment** | Screen application quality |\n| **Forums** | Reward high-quality contributions |\n\n---\n\n## 7. Integration Guide\n\n### API Quality Gating\n```python\nfrom adi import DumpindexAnalyzer\n\ndef route_request(input_text):\n    analyzer = DumpindexAnalyzer()\n    result = analyzer.analyze(input_text)\n    \n    if result['adi'] \u003e 1:\n        # Use cheap model for low-quality input\n        return gpt3_process(input_text)  \n    elif result['adi'] \u003c 0:\n        # Use high-quality model for valuable input\n        return gpt4_process(input_text)\n    else:\n        # Standard processing\n        return default_process(input_text)\n```\n\n### Expected Output\n```json\n{\n  \"adi\": -0.92,\n  \"metrics\": {\n    \"noise\": 0.05,\n    \"effort\": 0.91,\n    \"context\": 0.85,\n    \"details\": 0.78,\n    \"bonus\": 0.4,\n    \"penalty\": 0.1\n  },\n  \"diagnosis\": \"High-quality input: Contains code example and version details\",\n  \"suggestions\": [\n    \"Add error log for even better analysis\"\n  ]\n}\n```\n\n---\n\n## 8. Full Code\n\n\n### `adi.py`\nThis file contains the implementation of the Anti-Dump Algorithm. It includes functions to calculate noise, effort, context, details, bonus factors, and penalty factors, as well as to compute the ADI.\nYou can use the ADI as follows:\n```python\nfrom adi import DumpindexAnalyzer\n\n# Initialisiere den ADI-Analyzer\nanalyzer = DumpindexAnalyzer()\n```\n[View `adi.py` Source Code](./adi.py)\n\n### `example_app.py`\nThis file demonstrates how to use the `adi.py` implementation in a simple Flask application. It includes endpoints to analyze input text and return the ADI and recommendations.\n\n[View `example_app.py` Source Code](./example_app.py)\n\n---\n\n## 9. Extended Logic\n\n### 9.1 Typo Tolerance System\nAdjusts for error-proneness without penalizing non-native speakers:\n```python\ndef calculate_typos(self, text: str) -\u003e float:\n    \"\"\"Calculate typo percentage in text\"\"\"\n    words = text.split()\n    total_words = len(words)\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    return typos / max(total_words, 1)\n```\n\n### 9.2 Substance Profiler\nDetects \"pseudo-competent\" inputs that sound sophisticated but lack substance:\n```python\ndef calculate_substance_score(self, text: str) -\u003e float:\n    \"\"\"Detect fancy but empty inputs\"\"\"\n    pseudo_terms = r'\\b(optimal|synergy|innovative|disruptive|synergize)\\b'\n    pseudo_count = len(re.findall(pseudo_terms, text.lower()))\n    \n    return (self.calculate_effort(text) + self.calculate_details(text)) / \\\n           (self.calculate_noise(text) + pseudo_count + 1)\n```\n\n### 9.3 Adaptive Noise Calculation\nReduces noise impact when sufficient details are present:\n```python\ndef calculate_adjusted_noise(self, text: str) -\u003e float:\n    \"\"\"Adjust noise based on detail density\"\"\"\n    base_noise = self.calculate_noise(text)\n    detail_score = self.calculate_details(text)\n    total_words = len(text.split())\n    \n    return base_noise * (1 - detail_score / max(total_words, 1))\n```\n\n### 9.4 Anti-Dump Gradient\nMeasures sensitivity to input improvements:\n```math\n\\nabla\\text{ADI} = \\begin{bmatrix} \n\\frac{\\partial \\text{ADI}}{\\partial \\text{Effort}} \\\\\n\\frac{\\partial \\text{ADI}}{\\partial \\text{Details}} \n\\end{bmatrix} = \\begin{bmatrix} \n-\\frac{w_E}{D} \\\\ \n\\frac{w_N N \\cdot w_D}{D^2} \n\\end{bmatrix}\n```\nWhere \\( D \\) = Denominator of ADI formula\n\n---\n\n## 10. FAQs\n\n**Q: How do I adjust weights for my use case?**  \nA: Modify the weights dictionary:\n```python\ncustom_weights = {\n    'noise': 1.2,   # Increase if noise is critical\n    'details': 2.0,  # Prioritize technical depth\n    'bonus': 0.3     # Reduce formatting importance\n}\n```\n\n**Q: Can I use ADI with non-English text?**  \nA: Yes! Update the noise patterns and linguistic features in the calculation methods.\n\n**Q: What's the performance impact?**  \nA: Minimal - analysis takes \u003c100ms for typical inputs. Caching can optimize repeated requests.\n\n---\n\n## 11. License\nApache 2.0 License - [Full Text](LICENSE)\n\n**Acknowledgments**: To all who've suffered through \"URGENT!!!\" requests - may your inputs always be clear! 😄\n\n\u003e **Contribute**: Found this useful? Star the repo ⭐ or [buy me a coffee](https://buymeacoffee.com/volkandkca) ☕!\n\n**Stay Dump-Free!** 🚀\n\n\n","funding_links":["https://github.com/sponsors/volkansah","https://buymeacoffee.com/volkansah","https://buymeacoffee.com/volkandkca"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolkansah%2Fanti-dump-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvolkansah%2Fanti-dump-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolkansah%2Fanti-dump-algorithm/lists"}