JSPM

fast-dice-coefficient

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9977
  • Score
    100M100P100Q140135F
  • License ISC

Fastest implementation of Sørensen–Dice coefficient.

Package Exports

  • fast-dice-coefficient

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-dice-coefficient) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-dice-coefficient

Fastest implementation of Sørensen–Dice coefficient. This implementation has linear time complexity O(n), as opposed to other solutions: string-similarity, dice-coefficient, etc., running in cubic time O(n2).

This algorithm can be used to compute the similarity between strings. It return a fraction between 0 and 1, where 0 indicates no match and 1 indicates full match.

Install

$ npm i fast-dice-coefficient --save

Usage

dice = require('fast-dice-coefficient');

dice('javascript', 'coffeescript');
//=> 0.5

Benchmark

200 samples on i7-3667u and 8GB RAM.

Using two test-strings with 100 characters each.

Package ops/sec
stringSimilarity 7,590
natural.DiceCoefficient 11,117
dice-coefficient 14,732
fast-dice-coefficient 44,067
fast-levenshtein 4,495