/** * Pattern confidence calculation functions. * * This module contains functions for calculating how well a pattern * captures a dimensional rule, including action, aspect, and impact inference. */ import type { DimensionalRule, PatternRule } from '../dsl-types'; /** * Calculate confidence score for how well a pattern captures a dimensional rule. * * This function measures information preservation by comparing: * - Action preservation (weighted 3x) * - Aspect preservation (weighted 2.5x) * - Target preservation (weighted 2x) * - Impact preservation (weighted 2x) * - Node kind preservation (weighted 1.5x) * - Nested flag preservation (weighted 1x) * - Release type match (weighted 2x) * - Description preservation (weighted 0.5x) * * Useful for validating roundtrip transformations or choosing between * alternative pattern representations. * * @param dimensional - The original dimensional rule * @param pattern - The proposed pattern representation * @returns Confidence score between 0 and 1 * * @example * ```typescript * const dimensional: DimensionalRule = { * type: 'dimensional', * action: ['removed'], * target: ['export'], * returns: 'major' * } * * const pattern: PatternRule = { * type: 'pattern', * template: 'removed {target}', * variables: [{ name: 'target', value: 'export', type: 'target' }], * returns: 'major' * } * * const confidence = calculatePatternConfidence(dimensional, pattern) * // Returns: ~0.9 (high - action, target, and returns all match) * ``` * * @alpha */ export declare function calculatePatternConfidence(dimensional: DimensionalRule, pattern: PatternRule): number; //# sourceMappingURL=confidence.d.ts.map