import type { StatusConfig, PriorityConfig, NLPTriggersConfig, UserMappedField } from "./types.js"; export interface ParsedTaskData { title: string; details?: string; dueDate?: string; scheduledDate?: string; dueTime?: string; scheduledTime?: string; priority?: string; status?: string; tags: string[]; contexts: string[]; projects: string[]; recurrence?: string; estimate?: number; isCompleted?: boolean; userFields?: Record; } export type NumericDateOrder = "day-first" | "month-first"; export interface NaturalLanguageParserOptions { /** * Locale used for ambiguous numeric dates such as 11/06/2026. * This is intentionally separate from languageCode so English parsing can still * respect regional date order such as en-GB. */ dateLocale?: string; /** * Explicit numeric date order override. When omitted, dateLocale is used. */ dateOrder?: NumericDateOrder; } export declare class NaturalLanguageParserCore { private readonly recurrencePatterns; private readonly statusConfigs; private readonly priorityConfigs; private readonly defaultToScheduled; private readonly languageConfig; private readonly processingPipeline; private readonly boundaries; private readonly triggerConfig; private readonly options; constructor(statusConfigs?: StatusConfig[], priorityConfigs?: PriorityConfig[], defaultToScheduled?: boolean, languageCode?: string, nlpTriggers?: NLPTriggersConfig, userFields?: UserMappedField[], options?: NaturalLanguageParserOptions); /** * Creates boundary configuration based on language characteristics. * Non-ASCII languages (with accented characters, non-Latin scripts) need flexible boundaries. */ private createBoundaryConfig; /** * Get the appropriate chrono parser for the configured language. */ private getChronoParser; /** * Build the modular processing pipeline. * Each processor is self-contained and operates on the current state. */ private buildProcessingPipeline; /** * Parse natural language input into structured task data using a modular pipeline architecture. * Each processing stage is self-contained and can be easily reordered, added, or removed. */ parseInput(input: string): ParsedTaskData; private protectNlpLiterals; private protectObsidianLinks; private protectQuotedLiterals; private protectEscapedLiterals; private restoreProtectedLiterals; private restoreProtectedLiteralsInText; private isQuoteDelimiter; private isEligibleQuoteStart; private isEligibleQuoteEnd; private findClosingQuote; private shouldProtectEscapedLiteral; private startsWithEscapableTrigger; private getEscapableTriggers; private normalizeNumericDateLiterals; private getNumericDateOrder; private toValidatedISODate; private padDatePart; /** * Splits the input string into the first line (for parsing) and the rest (for details). */ private extractTitleAndDetails; /** Extracts tags from the text and adds them to the result object. */ private extractTags; /** Extracts contexts from the text and adds them to the result object. */ private extractContexts; /** Extracts projects and [[wikilinks]] from the text and adds them to the result object. */ private extractProjects; /** * Extracts user-defined field values from the text * Supports quoted values for multi-word content: trigger "multi word value" */ private extractUserFields; private matchTriggerTokens; private removeTriggerTokens; /** Extracts priority using shared phrase matching for custom and fallback priorities. */ private extractPriority; /** Extracts status using shared phrase matching for custom and fallback statuses. */ private extractStatus; /** * Finds a match using case-insensitive string search with boundary checking. * Returns the match details or null if no valid match found. */ private findTextMatch; /** * Finds the earliest whole-phrase match, preferring the longest phrase at the same position. */ private findPhraseMatch; private findPhraseValueMatch; private removePhraseMatch; private hasPhraseBoundaries; private getCodePointBefore; private getCodePointAt; private isWordCharacter; private includeTrailingPhraseSeparator; /** * Unified method to parse all dates and times with internationalized context awareness. * Combines the functionality of extractExplicitDates and parseDatesAndTimes. * * Processing order: * 1. Look for explicit trigger patterns: "due tomorrow", "scheduled for friday" * 2. Parse implicit dates using chrono-node with language-specific parser * 3. Determine if date is due/scheduled based on context and defaultToScheduled setting * * Trigger pattern examples: * - English: "due\s+", "scheduled\s+for" * - French: "échéance\s+", "programmé\s+pour" * - German: "fällig\s+am", "geplant\s+für" * * @param text Input text to parse * @param result ParsedTaskData object to populate with date/time fields * @returns Text with date/time patterns removed */ private parseUnifiedDatesAndTimes; /** * Use chrono-node to parse date starting from a specific position. * Uses language-specific chrono parser and validates that match starts near beginning. * * Position validation: Match must start within first 3 characters to account for * prepositions like "on", "at", "le", "am" in different languages. * * @param text Text to parse (typically after a trigger word) * @returns Parsed date result with success flag, formatted date/time, and matched text */ private parseChronoFromPosition; private getChronoMatchOffset; /** * Builds comprehensive recurrence patterns from language configuration. * Patterns are ordered by priority (most specific first) and cached for performance. */ private buildRecurrencePatterns; /** * Builds "every [ordinal] [weekday]" patterns (e.g., "every second monday"). * These have highest priority as they are most specific. */ private buildOrdinalWeekdayPatterns; /** * Builds "every [N] [period]" patterns (e.g., "every 3 days", "every 2 weeks"). */ private buildIntervalPatterns; /** * Builds "every other [period]" patterns (e.g., "every other week"). */ private buildEveryOtherPatterns; /** * Builds weekday patterns ("every [weekday]" and plural weekdays). */ private buildWeekdayPatterns; /** * Builds general frequency patterns (daily, weekly, monthly, yearly). */ private buildFrequencyPatterns; /** * Helper to determine frequency type from period text. */ private getPeriodFrequency; /** * Helper to get RRule weekday code from weekday text. */ private getWeekdayRRuleCode; /** * Helper to get RRule weekday code from plural weekday text. */ private getPluralWeekdayRRuleCode; /** * Extracts recurrence from text and generates rrule strings using cached language-aware patterns. * All patterns are internationalized and sourced from language configurations. */ private extractRecurrence; /** * Validate an rrule string to prevent parsing errors */ private isValidRRuleString; /** * Extracts time estimate from text using language-aware patterns. * Supports combined formats (1h30m), hours only (2hrs), and minutes only (45min). * * Pattern examples: * - Combined: "2h 30m" → 150 minutes * - Hours: "3 hours" → 180 minutes * - Minutes: "45 minutes" → 45 minutes * * @param text Input text to parse * @param result ParsedTaskData object to populate * @returns Text with time estimate patterns removed */ private extractTimeEstimate; /** * Ensures the final parsed data is valid and clean. */ private validateAndCleanupResult; private isValidDateString; private isValidTimeString; private escapeRegex; /** Cleans up whitespace after text extraction */ private cleanupWhitespace; /** * Generates a user-friendly preview of the parsed data. * Icons are placeholders for the UI layer to interpret. */ getPreviewData(parsed: ParsedTaskData): Array<{ icon: string; text: string; }>; /** * Generates a simple text-only preview of the parsed data. */ getPreviewText(parsed: ParsedTaskData): string; /** * Get status suggestions for autocomplete */ getStatusSuggestions(query: string, limit?: number): Array<{ value: string; label: string; display: string; }>; } //# sourceMappingURL=NaturalLanguageParserCore.d.ts.map