import type { CandidateFilterInput, CandidateNormalizer, KeywordResult, KeywordScorer, Lemmatizer, MultiWordScorer, SimilarityStrategy, SingleWordScorer, StopwordProvider, TextProcessor } from "./strategies.js"; import { Levenshtein } from "./similarity.js"; type DedupFunction = (cand1: string, cand2: string) => number; /** * Canonical public configuration for Yaket extraction. */ export interface YakeOptions { language?: string; n?: number; dedupLim?: number; dedupFunc?: string; windowSize?: number; top?: number; features?: string[] | null; stopwords?: Iterable; textProcessor?: TextProcessor; stopwordProvider?: StopwordProvider; dedupStrategy?: SimilarityStrategy | DedupFunction; lemmatizer?: Lemmatizer; candidateNormalizer?: CandidateNormalizer; singleWordScorer?: SingleWordScorer; multiWordScorer?: MultiWordScorer; keywordScorer?: KeywordScorer | ((candidates: KeywordResult[]) => KeywordResult[]); candidateFilter?: (candidate: CandidateFilterInput) => boolean; } /** * Backward-compatible option surface including deprecated alias keys. */ export interface KeywordExtractorOptions extends YakeOptions { /** @deprecated Use `language`. */ lan?: string; /** @deprecated Use `dedupLim`. */ dedup_lim?: number; /** @deprecated Use `dedupFunc`. */ dedup_func?: string; /** @deprecated Use `windowSize`. */ windowsSize?: number; /** @deprecated Use `windowSize`. */ window_size?: number; } /** * Tuple form of the simplified YAKE output. */ export type KeywordScore = [keyword: string, score: number]; interface NormalizedConfig { lan: string; n: number; dedupLim: number; dedupFunc: string; windowSize: number; top: number; features: string[] | null; } export declare class KeywordExtractor { readonly config: NormalizedConfig; readonly stopwordSet: Set; readonly textProcessor?: TextProcessor; readonly lemmatizer: Lemmatizer | null; readonly candidateNormalizer: CandidateNormalizer | null; readonly singleWordScorer: SingleWordScorer | null; readonly multiWordScorer: MultiWordScorer | null; readonly keywordScorer: ((candidates: KeywordResult[]) => KeywordResult[]) | null; readonly candidateFilter?: (candidate: CandidateFilterInput) => boolean; private readonly dedupFunction; /** * Creates a reusable keyword extractor with normalized options. */ constructor(options?: KeywordExtractorOptions); /** * Levenshtein-based dedup similarity. */ levs(cand1: string, cand2: string): number; /** * Sequence-style dedup similarity that approximates upstream YAKE's optimized path. */ seqm(cand1: string, cand2: string): number; /** * Jaro-based dedup similarity. */ jaro(cand1: string, cand2: string): number; /** * Extracts simplified keyword-score tuples. */ extractKeywords(text: string | null | undefined): KeywordScore[]; /** * Extracts richer keyword records with normalized forms and metadata. */ extractKeywordDetails(text: string | null | undefined): KeywordResult[]; /** * Python-style alias for `extractKeywords()`. * @deprecated Prefer `extractKeywords()` or `extract()` in TypeScript code. */ extract_keywords(text: string | null | undefined): KeywordScore[]; private getDedupFunction; } /** * One-shot helper for tuple-style extraction. */ export declare function extractKeywords(text: string, options?: KeywordExtractorOptions): KeywordScore[]; /** * Short alias for `extractKeywords()`. */ export declare function extract(text: string, options?: KeywordExtractorOptions): KeywordScore[]; /** * One-shot helper for detailed extraction. */ export declare function extractKeywordDetails(text: string, options?: KeywordExtractorOptions): KeywordResult[]; /** * Factory helper for reusable extractors. */ export declare function createKeywordExtractor(options?: KeywordExtractorOptions): KeywordExtractor; export { Levenshtein }; //# sourceMappingURL=KeywordExtractor.d.ts.map