"""Corpus-derived concept relations: synonyms, antonyms, rivalries, categories.

Replaces the hand-curated frozensets that lived in ``aborist.qa.concepts``
through April 2026 (commit c6182ae). The frozensets were Phase 1; this is
Phase 2.

The concept-relations layer is a **secondary index** over the existing
Merkle-committed corpus. Writes to ``concept_relations`` NEVER affect
``document_root``, ``chunk_root``, or ``cache_key`` — backfilling
relations is safe across the entire corpus without invalidating cached
answers or breaking audit chains.

Architecture:

- ``store.py``    — DB read/write helpers, append-only with UNIQUE-key idempotency
- ``extract.py``  — Extractor ABC + registry; per-source extractors plug in here
- ``query.py``    — Cross-shard ``synonyms_for(token)`` & ``rivalries_for(token)``
- ``seed.py``     — One-time migration of the legacy frozensets to manual rows

Public API for retrieval-time use (matches the legacy
``aborist.qa.concepts`` shape, so call sites in ``query.py`` keep working):

  synonym_expand(tokens, *, shards_dir) -> set[str]
  rivalry_excluded(tokens, *, shards_dir, compare_phrasing=False) -> set[str]
  has_compare_phrasing(question) -> bool
"""

from __future__ import annotations

from aborist.concepts.query import (
    has_compare_phrasing,
    invalidate_cache,
    rivalry_excluded,
    synonym_expand,
)
from aborist.concepts.store import (
    add_concept_relation,
    concept_relations_for_token,
    purge_by_evidence_kind,
)

__all__ = [
    "add_concept_relation",
    "concept_relations_for_token",
    "has_compare_phrasing",
    "invalidate_cache",
    "purge_by_evidence_kind",
    "rivalry_excluded",
    "synonym_expand",
]
