import { type KeywordExtractorOptions } from "./KeywordExtractor.js"; import type { KeywordResult } from "./strategies.js"; /** * Minimal document shape for pipeline-oriented extraction. */ export interface InputDocument> { id: string; body: string; language?: string; title?: string; metadata?: TMetadata; } /** * Extraction result paired with the original document identity and metadata. */ export interface DocumentKeywordResult> { id: string; language: string; title?: string; metadata?: TMetadata; keywords: KeywordResult[]; } /** * Context passed to pre-extraction document text hooks. */ export interface DocumentTextHookContext { document: InputDocument; language: string; includeTitleInText: boolean; } /** * Context passed to post-extraction keyword hooks. */ export interface DocumentKeywordHookContext { document: InputDocument; language: string; text: string; } /** * Extraction options for document helpers. */ export interface DocumentExtractionOptions extends KeywordExtractorOptions { includeTitleInText?: boolean; beforeExtractText?: (text: string, context: DocumentTextHookContext) => string; afterExtractKeywords?: (keywords: KeywordResult[], context: DocumentKeywordHookContext) => KeywordResult[]; } /** * Extracts keyword details from a single document. */ export declare function extractFromDocument>(document: InputDocument, options?: DocumentExtractionOptions): DocumentKeywordResult; /** * Extracts keyword details for an iterable of documents. */ export declare function extractFromDocuments>(documents: Iterable>, options?: DocumentExtractionOptions): Array>; /** * Extracts keyword details for an async stream of documents. */ export declare function extractFromDocumentStream>(documents: AsyncIterable>, options?: DocumentExtractionOptions): AsyncGenerator>; /** * Stable JSON serialization for a document extraction result. */ export declare function serializeDocumentKeywordResult>(result: DocumentKeywordResult): string; /** * Stable JSON serialization for an ordered collection of document extraction results. */ export declare function serializeDocumentKeywordResults>(results: Iterable>): string; /** * Estimates the UTF-8 byte size of a stable serialized payload. */ export declare function estimateSerializedBytes(value: unknown): number; //# sourceMappingURL=document.d.ts.map