包详细信息

ngh-edit-distance

A simple function that calculates the edit distance between two strings.

EditDistance, LevenshteinDistance

自述文件

Ngh-Edit-Distance

A simple function that calculates the edit distance distance between two strings.

Installation

npm i ngh-edit-distance

Basic usage

const editDistance = require('ngh-edit-distance');

let  str = "horse";
let str2 = "ros";

console.log(editDistance(str, str2)) //3

Show matrix

Displays on console the Levenshtein distance algorithm matrix

const editDistance = require('ngh-edit-distance');

let  str = "horse";
let str2 = "ros";

console.log(editDistance(str, str2, true)) //3