import { KeyphraseEntry } from './types'; /** * Folds smaller keyphrases that are near-subsets of larger ones, merging their * weights and sentence lists upward. * * Two phrases are considered overlapping when they share all-but-one word * (i.e., the number of words in the smaller phrase that do **not** appear in * the larger phrase is fewer than 2). When a merge occurs: * - The larger phrase absorbs a fraction of the smaller one's weight * (`smallWeight / largerWordCount`). * - Sentence indices are union-merged. * - If the smaller phrase actually outweighs the larger at that point, the * larger entry adopts the smaller phrase's text (best representative wins). * * Phrases are processed largest-first so that supersets are always evaluated * before their constituent sub-phrases. * * @param keyphrases - Raw scored keyphrases, any order. * @returns Deduplicated, folded array \u2014 larger representative phrases only. * * @example * const folded = foldSubphrases([ * { keyphrase: "machine learning", words: 2, weight: 10, sentences: [0, 1] }, * { keyphrase: "machine", words: 1, weight: 4, sentences: [0, 2] }, * ]); * // "machine" is absorbed into "machine learning" */ export declare function foldSubphrases(keyphrases: KeyphraseEntry[]): KeyphraseEntry[];