# AI brand alias matching test corpus

This is a small, dependency-free regression corpus for an analyst counting brand mentions in AI answers. **All 24 cases and every alias are synthetic fixtures.** They are not observations of an AI provider, a company, a domain, or a recommendation result.

## Files

- `aliases.csv`: the declared entity registry. Each alias belongs to an entity and has a documented alias type.
- `cases.csv`: 24 synthetic observations with the expected decision and reviewer note.
- `match_aliases.py`: the reference implementation.
- `expected.csv`: frozen deterministic output generated from the two input files.

## Run

```bash
python3 match_aliases.py --output actual.csv
cmp expected.csv actual.csv
```

The command writes `actual.csv` (or the path passed to `--output`) and leaves the frozen expected file untouched. A regression check compares generated bytes with the committed file:

```bash
python3 match_aliases.py --output actual.csv
cmp --silent expected.csv actual.csv && echo "PASS: byte match"
```

The matcher tries an exact alias lookup first. If there is no exact hit, it applies Unicode NFKC normalization, case-folding, and removal of non-word separators. It accepts a normalized result only when one entity remains. A collision is `review`; it is never guessed. A product, parent, subsidiary, or namesake is not merged merely because its words overlap.

This baseline deliberately does not infer redirects, ownership, legal relationships, language equivalence, or context from an answer. Add an alias only when your study's evidence policy supports it, then add a case that protects the intended boundary.
