UNPKG

@leolee9086/string-metrics-dice

Version:
40 lines (39 loc) 884 B
/* tslint:disable */ /* eslint-disable */ /** * 计算Sørensen-Dice系数 * * 算法公式: Dice = 2 * |A ∩ B| / (|A| + |B|) * * # Arguments * * `str1` - 第一个字符串 * * `str2` - 第二个字符串 * * `options` - 计算选项 * * # Returns * * Dice系数,范围[0,1] */ export function compute_dice_coefficient(str1: string, str2: string, options?: DiceOptions | null): number; /** * 计算Dice距离(1 - Dice系数) */ export function compute_dice_distance(str1: string, str2: string, options?: DiceOptions | null): number; /** * 获取算法信息 */ export function get_algorithm_info(): any; /** * Dice系数计算选项 */ export class DiceOptions { private constructor(); free(): void; /** * 创建新的DiceOptions实例 */ static new(n_gram_size: number): DiceOptions; /** * n-gram大小 */ n_gram_size: number; }