/** * Literal Extractor * * Extracts literals from code chunks for indexing. * For TypeScript/JavaScript, uses the chunk name from AST parsing. * * This is a pure domain service with no external dependencies. */ import type { Chunk } from "../entities/chunk"; import type { ExtractedLiteral } from "../entities/literal"; /** * Extract vocabulary words from a literal (identifier) name. * * Handles multiple naming conventions: * - camelCase: getUserById → ["get", "user", "by", "id"] * - PascalCase: AuthService → ["auth", "service"] * - snake_case: get_user_by_id → ["get", "user", "by", "id"] * - kebab-case: get-user-by-id → ["get", "user", "by", "id"] * - SCREAMING_SNAKE_CASE: MAX_RETRY_COUNT → ["max", "retry", "count"] * * @param literal - The identifier name to extract vocabulary from * @returns Array of unique vocabulary words (lowercase, length > 1) */ export declare function extractVocabulary(literal: string): string[]; /** * Extract vocabulary words from a natural language query. * * Unlike extractVocabulary (for identifiers), this: * 1. Tokenizes the query into words * 2. Filters out stop words * 3. Handles both natural language and embedded identifiers * 4. Returns unique, normalized vocabulary words * * @param query - The search query string * @returns Array of unique vocabulary words (lowercase, length > 1) * * @example * extractQueryVocabulary("where is user session validated") * // → ["user", "session", "validated"] * * extractQueryVocabulary("find the authenticateUser function") * // → ["authenticate", "user"] (identifier decomposed) */ export declare function extractQueryVocabulary(query: string): string[]; /** * Extract literals from a code chunk. * * For TypeScript/JavaScript chunks, this extracts the chunk's name * as a "definition" literal. The name comes from proper AST parsing, * so it's accurate and reliable. * * Also extracts vocabulary words from the literal for partial matching. * * @param chunk - The code chunk to extract literals from * @returns Array of extracted literals (typically just the definition) */ export declare function extractLiterals(chunk: Chunk): ExtractedLiteral[]; /** * Extract literals from a code chunk with additional reference extraction. * * This version also extracts references from the chunk content using * pattern matching. Use this for modules that want deeper literal indexing. * * @param chunk - The code chunk to extract literals from * @param options - Extraction options * @returns Array of extracted literals */ export declare function extractLiteralsWithReferences(chunk: Chunk, options?: { includeImports?: boolean; includeTypeRefs?: boolean; }): ExtractedLiteral[];