/** * @fileoverview Natural language date parsing utilities * Provides intelligent parsing of human-readable date strings */ /** * Options for natural language parsing */ export interface NaturalParseOptions { /** Reference date for relative parsing (defaults to now) */ referenceDate?: Date; /** Preferred time for dates without time specified */ defaultTime?: { hour: number; minute: number; second?: number; }; /** Whether to skip permissive fallback parsing */ strict?: boolean; } /** * Extracted date information from text */ export interface ExtractedDate { /** The parsed date */ date: Date; /** The original text that was matched */ text: string; /** Starting position in the original text */ index: number; /** Type of date pattern matched */ type: 'absolute' | 'relative' | 'range' | 'time'; /** Confidence score (0-1) */ confidence: number; } /** * Parses natural language date strings into Date objects * @param input - Natural language date string * @param options - Parsing options * @returns Parsed date or null if unable to parse * * @example * ```ts * parseNaturalDate('tomorrow at 3pm'); * // Date for tomorrow at 15:00 * * parseNaturalDate('next Friday'); * // Date for next Friday * * parseNaturalDate('in 2 weeks'); * // Date 2 weeks from now * * parseNaturalDate('December 25th'); * // Date for Dec 25 this year (or next if passed) * ``` */ export declare function parseNaturalDate(input: string, options?: NaturalParseOptions): Date | null; /** * Parses a relative time phrase into a Date * @param input - Relative time phrase * @param referenceDate - Reference date (defaults to now) * @returns Parsed date or null * * @example * ```ts * parseRelativePhrase('in 2 hours'); // 2 hours from now * parseRelativePhrase('5 minutes ago'); // 5 minutes ago * parseRelativePhrase('next week'); // 7 days from now * ``` */ export declare function parseRelativePhrase(input: string, referenceDate?: Date): Date | null; /** * Extracts all dates from a text string * @param text - Text to extract dates from * @param options - Extraction options * @returns Array of extracted date information * * @example * ```ts * const text = "Meeting tomorrow at 3pm and dinner next Friday at 7pm"; * const dates = extractDatesFromText(text); * // [ * // { date: Date(...), text: 'tomorrow at 3pm', index: 8, ... }, * // { date: Date(...), text: 'next Friday at 7pm', index: 37, ... } * // ] * ``` */ export declare function extractDatesFromText(text: string, options?: NaturalParseOptions): ExtractedDate[]; /** * Suggests possible dates based on context * @param context - Context string to analyze * @param options - Parsing options * @returns Array of suggested dates with confidence scores * * @example * ```ts * suggestDateFromContext('deadline is end of month'); * // [{ date: Date(last day of current month), confidence: 0.8, ... }] * ``` */ export declare function suggestDateFromContext(context: string, options?: NaturalParseOptions): Array<{ date: Date; text: string; confidence: number; }>; //# sourceMappingURL=naturalLanguage.d.ts.map