Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

weighted-damerau-levenshtein

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weighted-damerau-levenshtein

An implementation of weighted Damerau–Levenshtein distance.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
144
decreased by-65.55%
Maintainers
1
Weekly downloads
 
Created
Source

Weighted Damerau–Levenshtein distance

Travis (.org) Coverage Status NPM

A simple Node module that allows you to compute Damerau–Levenshtein distance with custom weights for insertion, deletion and/or substitution (they all default to 1). It is inspired by the damerau-levenshtein and damerau-levenshtein-js packages.

let dldist = require('weighted-damerau-levenshtein');

const d = dldist('hello word', 'Hello World!');
// 4 -> two substitutions and two insertions

const s = dldist('hello word', 'Hello World!', { insWeight: 0.5 });
// 3 -> two substitutions with weight 1 and two insertions with weight 0.5

It also optionally allows you to turn-off the "Damerau" part of the Damerau-Levenshtein distance (i..e the transpositions), which makes it the standard Levenshtein distance.

let dldist = require('weighted-damerau-levenshtein');

const d = dldist('Hi there', 'Hi tehre');
// 1 -> one transpostion (counted with the default subsitution weight)

const s = dldist('Hi there', 'Hi tehre', { useDamerau: false });
// 2 -> one substitution and one deletion (both with default weight)

Install

npm install weighted-damerau-levenshtein

License

Licensed under the terms of the Apache 2.0 license. See the LICENSE file for more details.

Keywords

FAQs

Package last updated on 01 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc