Sørensen–Dice coefficient
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

readme.md

dice-coefficient Build Status Coverage Status

Sørensen–Dice coefficient.

API

Install:

npm install dice-coefficient

Use:

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

dice('abc', 'abc'); //=> 1
dice('abc', 'xyz'); //=> 0
dice('night', 'nacht'); //=> 0.25
dice('night', 'nacht') === dice('NiGhT', 'NACHT'); //=> true

CLI

Install:

npm install -g dice-coefficient

Use:

Usage: dice-coefficient [options] <word> <word>

Sørensen–Dice coefficient

Options:

  -h, --help           output usage information
  -v, --version        output version number

Usage:

# output edit distance
$ dice-coefficient night nacht
# 0.25

# output edit distance from stdin
$ echo "saturday sunday" | dice-coefficient
# 0.3333333333333333

License

MIT © Titus Wormer