/** * Similarity Scoring for Frame Deduplication * * Computes similarity scores between frames to detect potential duplicates. * Uses multiple dimensions: semantic (keywords), structural (modules), and temporal. */ import type { Frame } from "./frames/types.js"; /** * Breakdown of similarity score by dimension */ export interface SimilarityDimensions { /** Keyword overlap using Jaccard similarity */ semantic: number; /** Module scope overlap */ structural: number; /** Temporal proximity (same day/hour) */ temporal: number; } /** * Result of comparing two frames for similarity */ export interface SimilarityResult { frameA: string; frameB: string; overall: number; dimensions: SimilarityDimensions; } /** * Weights for combining similarity dimensions */ export interface SimilarityWeights { semantic: number; structural: number; temporal: number; } /** * Default weights for similarity scoring */ export declare const DEFAULT_WEIGHTS: SimilarityWeights; /** * Compute keyword similarity using Jaccard index * Includes keywords from summary, reference point, and explicit keywords field */ export declare function computeKeywordSimilarity(frameA: Frame, frameB: Frame): number; /** * Compute structural similarity based on module_scope overlap */ export declare function computeStructuralSimilarity(frameA: Frame, frameB: Frame): number; /** * Compute temporal similarity based on timestamp proximity * Returns 1.0 for same hour, 0.5 for same day, 0.25 for same week, 0.0 otherwise */ export declare function computeTemporalSimilarity(frameA: Frame, frameB: Frame): number; /** * Compute overall similarity between two frames * @param frameA - First frame * @param frameB - Second frame * @param weights - Optional custom weights (defaults to DEFAULT_WEIGHTS) * @returns Similarity result with overall score and dimension breakdown */ export declare function computeSimilarity(frameA: Frame, frameB: Frame, weights?: SimilarityWeights): SimilarityResult; /** * Detect potential duplicates of a frame within a set of existing frames * @param newFrame - Frame to check for duplicates * @param existingFrames - Existing frames to compare against * @param threshold - Similarity threshold (0.0 - 1.0, default: 0.85) * @param weights - Optional custom weights for similarity scoring * @returns Array of similar frames sorted by similarity (highest first) */ export declare function detectDuplicates(newFrame: Frame, existingFrames: Frame[], threshold?: number, weights?: SimilarityWeights): SimilarityResult[];