Skip to content
Back to skills

Answer Accumulation Filter

ASecurity

Parse sequential yes/no answers to build inclusion/exclusion sets, then apply compound boolean filters to narrow a candidate list

  • 61 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
datapythongodatabase

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill answer-accumulation-filter --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Answer Accumulation Filter?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Answer Accumulation Filter
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-answer-accumulation-filter/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-answer-accumulation-filter)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: llm-answer-accumulation-filter
description: Parse sequential yes/no answers to build inclusion/exclusion sets, then apply compound boolean filters to narrow a candidate list
---

# Answer Accumulation Filter

## Overview

In multi-turn question-answering games, each yes/no answer constrains the solution space. Maintain parallel inclusion and exclusion sets for each attribute dimension (category, region, letter). After each answer, update the appropriate set, then apply all filters as a compound boolean mask on the candidate dataframe. This turns sequential dialogue into progressively tighter database queries.

## Quick Start

```python
import pandas as pd

class AnswerAccumulator:
    def __init__(self, candidates_df):
        self.candidates = candidates_df
        self.include = {}  # attr -> set of included values
        self.exclude = {}  # attr -> set of excluded values

    def update(self, attr, value, answer_is_yes):
        if answer_is_yes:
            self.include.setdefault(attr, set()).add(value)
        else:
            self.exclude.setdefault(attr, set()).add(value)

    def filter(self):
        mask = pd.Series(True, index=self.candidates.index)
        for attr, vals in self.include.items():
            mask &= self.candidates[attr].isin(vals)
        for attr, vals in self.exclude.items():
            mask &= ~self.candidates[attr].isin(vals)
        return self.candidates[mask]

acc = AnswerAccumulator(keywords_df)
acc.update('category', 'place', answer_is_yes=True)
acc.update('continent', 'Europe', answer_is_yes=False)
remaining = acc.filter()  # all places not in Europe
```

## Workflow

1. Initialize with full candidate dataframe and empty include/exclude dicts
2. After each yes/no answer, call `update(attribute, value, is_yes)`
3. Call `filter()` to get remaining candidates matching all constraints
4. Use `len(remaining)` to decide whether to ask more questions or guess

## Key Decisions

- **Attribute dimensions**: category, region, first_letter are typical; add more for richer datasets
- **Include vs exclude**: "yes" → include (whitelist), "no" → exclude (blacklist)
- **Multiple includes**: if multiple values included for same attribute, use OR (any match)
- **Empty sets**: no constraint on that dimension — don't filter

## References

- [Starter Code for Llama 8B LLM - [LB 0.750+]](https://www.kaggle.com/code/cdeotte/starter-code-for-llama-8b-llm-lb-0-750)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.