UNPKG

align-arr

Version:

Find the minimal edit path between two generic arrays.

29 lines (28 loc) 1.02 kB
import { Edit } from './types'; /** * Calculates the total sum of costs for an alignment. * @param alignment Array of edit operations * @returns Total cost (number) */ export declare const cost: (alignment: Edit[]) => number; /** * Calculates the normalized cost [0, 1] for an alignment. * Defined as cost(alignment) / alignment.length. * @param alignment Array of edit operations * @returns Normalized distance (number) */ export declare const distance: (alignment: Edit[]) => number; /** * Calculates the similarity score for an alignment. * Defined as 1 - distance(alignment). * @param alignment Array of edit operations * @returns Similarity score (number) */ export declare const similarity: (alignment: Edit[]) => number; /** * Calculates the normalized cost ratio for an alignment. * Defined as (alignment.length - cost(alignment)) / alignment.length. * @param alignment Array of edit operations * @returns Normalized ratio (number) */ export declare const ratio: (alignment: Edit[]) => number;