/** * Parser-specific types * These were previously in @sharpee/if-domain but are now local to the parser */ import type { IParsedCommand, IParseError as CoreParseError } from '@sharpee/world-model'; /** * Parser interface */ export interface Parser { parse(input: string): CommandResult; setDebugCallback?(callback: ((event: any) => void) | undefined): void; } /** * Parser options */ export interface ParserOptions { allowPartial?: boolean; expandAbbreviations?: boolean; ignoreArticles?: boolean; minConfidence?: number; } /** * Internal token representation */ export interface Token { word: string; normalized: string; position: number; candidates: TokenCandidate[]; } /** * Token candidate */ export interface TokenCandidate { partOfSpeech: PartOfSpeech; mapsTo: string; priority?: number; source?: string; metadata?: Record; } /** * Command result wrapper */ export type CommandResult = { success: true; value: T; } | { success: false; error: E; }; /** * Candidate command (legacy format) */ export interface CandidateCommand { action: string; originalInput: string; tokens: Token[]; pattern: string; confidence: number; nounText?: string; nounCandidates?: string[]; preposition?: string; secondNounText?: string; secondNounCandidates?: string[]; } /** * Internal parse result (legacy format) */ export interface InternalParseResult { candidates: CandidateCommand[]; errors: ParseError[]; partial: boolean; } /** * Parse error types */ export declare enum ParseErrorType { UNKNOWN_WORD = "UNKNOWN_WORD", PATTERN_MISMATCH = "PATTERN_MISMATCH", AMBIGUOUS = "AMBIGUOUS", NO_COMMAND = "NO_COMMAND" } /** * Parse error */ export interface ParseError { type: ParseErrorType; message: string; words?: string[]; position?: number; } /** * Vocabulary part of speech */ export declare enum PartOfSpeech { VERB = "VERB", NOUN = "NOUN", ADJECTIVE = "ADJECTIVE", ARTICLE = "ARTICLE", PREPOSITION = "PREPOSITION", PRONOUN = "PRONOUN", DIRECTION = "DIRECTION", SPECIAL = "SPECIAL" } /** * Grammar patterns */ export interface GrammarPatterns { patterns: Array<{ name: string; pattern: string; action?: string; }>; } /** * Language provider interface */ export interface LanguageProvider { getVerbs?(): Array<{ actionId: string; verbs: string[]; }>; getDirections?(): Array<{ directionId: string; words: string[]; }>; getSpecialWords?(): Record; } /** * Vocabulary entry */ export interface VocabularyEntry { word: string; partOfSpeech: PartOfSpeech; mapsTo: string; priority?: number; source?: string; metadata?: Record; } /** * Simple vocabulary registry */ export declare class VocabularyRegistry { private entries; clear(): void; register(entry: VocabularyEntry): void; registerVerbs(verbs: Array<{ word: string; mapsTo: string; priority?: number; }>): void; registerDirections(directions: Array<{ word: string; mapsTo: string; }>): void; registerSpecial(special: Array<{ word: string; type: string; }>): void; lookup(word: string): VocabularyEntry[]; } export declare const vocabularyRegistry: VocabularyRegistry; /** * Adapt verb vocabulary from language provider format */ export declare function adaptVerbVocabulary(language: LanguageProvider): Array<{ word: string; mapsTo: string; priority?: number; }>; /** * Adapt direction vocabulary from language provider format */ export declare function adaptDirectionVocabulary(language: LanguageProvider): Array<{ word: string; mapsTo: string; }>; /** * Adapt special vocabulary from language provider format */ export declare function adaptSpecialVocabulary(language: LanguageProvider): Array<{ word: string; type: string; }>; //# sourceMappingURL=parser-types.d.ts.map