import type { LLMProvider } from '../adapter/llm-provider.js'; import { Classifier } from '../pipeline/classifier.js'; import type { KnowledgeEntry, KnowledgeSource } from '../types/index.js'; import { ChunkStrategy, type ChunkOptions } from './chunk-strategy.js'; import { type DocumentParser, type ParsedSection } from './document-parser.js'; import { type AnalysisArtifact } from './analysis-artifact.js'; export interface DocumentExtractionResult { entries: KnowledgeEntry[]; artifact: AnalysisArtifact; } export interface DocumentMetadata { path: string; title?: string; } export type DocumentLLMProvider = LLMProvider; export interface DocumentExtractorOptions { /** Minimum content length to consider a section extractable */ minContentLength?: number; /** Minimum confidence threshold (retained for scoring; all entries are 'active') */ minConfidence?: number; /** Custom classifier instance */ classifier?: Classifier; /** Optional LLM provider for semantic extraction */ llmProvider?: DocumentLLMProvider; /** Optional parser override */ parser?: DocumentParser; /** Optional chunk strategy override */ chunkStrategy?: ChunkStrategy; /** Chunk settings used when llmProvider is present */ chunkOptions?: ChunkOptions; } export declare class DocumentExtractor { private classifier; private minContentLength; private minConfidence; private llmProvider?; private parser; private chunkStrategy; constructor(options?: DocumentExtractorOptions); /** * Extract KnowledgeEntry[] from parsed sections. * Each section with sufficient content becomes one entry. */ extract(sections: ParsedSection[], source: KnowledgeSource): Promise; extractFromMarkdown(markdown: string, metadata: DocumentMetadata, source: KnowledgeSource, existingEntries?: KnowledgeEntry[]): Promise; extractFromMarkdownWithArtifact(markdown: string, metadata: DocumentMetadata, source: KnowledgeSource, existingEntries?: KnowledgeEntry[]): Promise; /** * Resolve type: if classifier returns low confidence, use heuristics * based on section structure (e.g., methodology for step-like content). */ private resolveType; private isValidType; private looksLikeMethodology; private extractTags; private extractDomain; private generateTitle; private generateSummary; /** * FR-A02 AC1: Extract from any supported format. * Detects format from metadata/content, selects the right parser, and runs extraction. * Supports markdown, plain text, HTML, and pre-converted PDF/EPUB content. */ extractFromDocument(content: string, metadata: DocumentMetadata, source: KnowledgeSource, existingEntries?: KnowledgeEntry[], format?: DocumentFormat): Promise; /** * FR-A02 AC1+AC5: Extract from any format with Analysis Artifact. */ extractFromDocumentWithArtifact(content: string, metadata: DocumentMetadata, source: KnowledgeSource, existingEntries?: KnowledgeEntry[], format?: DocumentFormat): Promise; private dedupeEntries; private toKnowledgeEntry; } /** * Supported document formats for FR-A02 AC1. * 'auto' attempts to detect format from metadata or content. */ export type DocumentFormat = 'markdown' | 'plaintext' | 'html' | 'auto'; /** * Detect document format from file path extension or content heuristics. * PDF/EPUB are expected to be pre-converted to text before reaching the extractor. */ export declare function detectDocumentFormat(metadata: DocumentMetadata, content: string): DocumentFormat; export type { ParsedSection } from './document-parser.js'; //# sourceMappingURL=document-extractor.d.ts.map