"""
extractor.analytics — Cross-document entity intelligence layer.

Build an EntityIndex from extracted JSONL files, canonicalize entity surface forms,
compute corpus statistics, and generate provenance citations for RAG answers.

Usage:
    from extractor.analytics import EntityIndex, Canonicalizer, EntityCitation, cite_entity

    index = EntityIndex.build_from_jsonl(["doc1.jsonl", "doc2.jsonl"])
    index.save("entity_index.json")

    top = index.top_entities(entity_type="person", n=10)
    citations = cite_entity("person:tim-cook", index)
"""

from .canonicalizer import Canonicalizer, normalize_surface
from .citations import EntityCitation, cite_entity, explain_answer_entities
from .corpus_analytics import (
    entity_doc_cooccurrence,
    entity_frequency_table,
    top_entities_by_section,
)
from .entity_index import CanonicalEntity, EntityIndex, EntityMention

__all__ = [
    "EntityIndex",
    "EntityMention",
    "CanonicalEntity",
    "Canonicalizer",
    "normalize_surface",
    "entity_frequency_table",
    "entity_doc_cooccurrence",
    "top_entities_by_section",
    "EntityCitation",
    "cite_entity",
    "explain_answer_entities",
]
