/** * Vocabulary Dump (counts-only) * * Inventory of the vocabulary available in an AAC pageset, aggregated by * source and part of speech. Only counts are emitted — never word lists — * so the output is safe to embed in privacy-preserving reports. * * Sources counted: * buttons — labelled buttons (the static on-board vocabulary) * wordLists — page WordLists feeding dynamic AutoContent cells * (Grid 3 ``; absent in other formats) * predictionDictionaries — prediction wordlists attached to prediction cells * (Grid 3 `Prediction.PredictThis` dictionaries) * wordForms — smart-grammar inflections generated by * MetricsCalculator (only when a MetricsResult is * supplied) * * Non-Grid 3 formats simply report zeros for the Grid 3-specific sources. */ import type { AACTree } from '../../../types/aac'; import type { MetricsResult } from './types'; /** Counts for one vocabulary source. */ export interface VocabularySourceCounts { /** Total entries found in this source (before deduplication). */ entries: number; /** Unique single words after normalisation. */ uniqueWords: number; /** Unique multi-word phrases after normalisation (e.g. "thank you"). */ uniquePhrases: number; /** Unique entries per part-of-speech tag ('Unknown' when untagged). */ byPartOfSpeech: Record; } /** Aggregated, counts-only vocabulary inventory. */ export interface VocabularySummary { totalBoards: number; totalButtons: number; /** Vocabulary carried by labelled buttons. */ buttons: VocabularySourceCounts; /** Page WordLists (dynamic content cells; Grid 3). */ wordLists: VocabularySourceCounts & { lists: number; }; /** Prediction dictionaries attached to prediction cells (Grid 3). */ predictionDictionaries: VocabularySourceCounts & { buttonsWithDictionaries: number; }; /** Smart-grammar inflections; null when no MetricsResult was supplied. */ wordForms: (VocabularySourceCounts & { parentButtons: number; }) | null; /** Unique entries across all sources combined. */ combined: { uniqueEntries: number; uniqueWords: number; uniquePhrases: number; }; } /** Full vocabulary dump document (schema-versioned). */ export interface VocabularyDump { schema: 'aac-vocabulary-dump/v1'; generatedAt: string; source: { format?: string; name?: string; locale?: string; }; summary: VocabularySummary; } export interface VocabularyDumpOptions { /** * Precomputed metrics (MetricsCalculator.analyze). Enables the * smart-grammar word-form counts. Run analyze() BEFORE dumpVocabulary(): * analyze() expands morphological predictions on the tree. */ metrics?: MetricsResult; } /** * Count the vocabulary available in a pageset, by source and part of speech. * Emits counts only — no word lists. * * @example * const processor = new GridsetProcessor(); * const tree = await processor.loadIntoTree('my.gridset'); * const metrics = new MetricsCalculator().analyze(tree); * const dump = dumpVocabulary(tree, { metrics }); * console.log(dump.summary.wordLists.lists, 'wordlists'); */ export declare function dumpVocabulary(tree: AACTree, options?: VocabularyDumpOptions): VocabularyDump;