damerau-levenshtein
Damerau - Levenshtein distance by The Spanish Inquisition + relative distance
Last updated 3 years ago by lazurski .
BSD-2-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ npm install damerau-levenshtein 
SYNC missed versions from official npm registry.

NPM

It provides a function that takes two string arguments and returns a hash like this:

{
  steps: 5,       // Levenstein demerau distance
  relative: 0.7,  // steps / length of the longer string
  similarity: 0.3 // 1 - relative
}

Install

npm install damerau-levenshtein

Use with ES6 modules

import * as levenshtein from 'damerau-levenshtein';

const lev = levenshtein('hello world', 'Hello World!');
// { steps: 4, relative: 0.3076923076923077, similarity: 0.6923076923076923 }

Please see tests for more insights.

Use with TypeScript

import * as levenshtein from 'damerau-levenshtein';

interface LevenshteinResponse {
  steps: number;
  relative: number;
  similarity: number;
}

const lev: LevenshteinResponse = levenshtein('hello world', 'Hello World!');

console.log(lev.steps);
// 2
console.log(lev.foo);
// TypeScript Error: Property 'foo' does not exist on type 'LevenshteinResponse'.

Current Tags

  • 1.0.8                                ...           latest (3 years ago)

11 Versions

  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           4 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           6 years ago
  • 1.0.4                                ...           8 years ago
  • 1.0.3                                ...           8 years ago
  • 1.0.2                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           9 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
Maintainers (1)
Downloads
Total 9
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE