/** * @file English Grammar Engine * @description English-specific implementation of grammar matching */ import { GrammarEngine, GrammarContext, PatternMatch, GrammarMatchOptions, SlotMatch } from '@sharpee/if-domain'; import { Token } from '@sharpee/if-domain'; import { SlotConsumerRegistry } from './slot-consumers'; import type { PartialMatchFailure } from './parse-failure'; /** * Result of attempting to match a rule - either success or failure with info */ export type MatchAttemptResult = { success: true; match: PatternMatch; } | { success: false; failure: PartialMatchFailure; }; /** * Extended match options with failure tracking */ export interface ExtendedMatchOptions extends GrammarMatchOptions { /** If true, collect partial match failures for error reporting */ trackFailures?: boolean; } /** * Result of findMatches with optional failure information */ export interface MatchResult { matches: PatternMatch[]; failures?: PartialMatchFailure[]; } /** * English-specific grammar matching engine */ export declare class EnglishGrammarEngine extends GrammarEngine { private slotConsumerRegistry; /** Last set of partial match failures (for error reporting) */ private lastFailures; constructor(slotConsumerRegistry?: SlotConsumerRegistry); /** * Get the last set of partial match failures (for error reporting) */ getLastFailures(): PartialMatchFailure[]; /** * Find matching grammar rules for tokens */ findMatches(tokens: Token[], context: GrammarContext, options?: GrammarMatchOptions): PatternMatch[]; /** * Try to match a single rule against tokens */ private tryMatchRule; /** * Try to match a single rule against tokens, returning failure info if no match */ private tryMatchRuleWithFailure; /** * Build semantic properties from rule and matched tokens */ private buildSemantics; /** * Consume tokens for a slot */ private consumeSlot; /** * Extract typed value from a NUMBER slot match */ static extractNumberValue(match: SlotMatch): number | null; /** * Extract typed value from an ORDINAL slot match */ static extractOrdinalValue(match: SlotMatch): number | null; /** * Extract canonical direction from a DIRECTION slot match */ static extractDirectionValue(match: SlotMatch): string | null; /** * Extract time components from a TIME slot match */ static extractTimeValue(match: SlotMatch): { hours: number; minutes: number; } | null; } //# sourceMappingURL=english-grammar-engine.d.ts.map