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

dice-coefficient

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dice-coefficient - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

cli.js

28

package.json
{
"name": "dice-coefficient",
"version": "0.1.2",
"version": "0.1.3",
"description": "Sørensen–Dice coefficient",

@@ -10,3 +10,5 @@ "license": "MIT",

"dice",
"coefficient"
"coefficient",
"cli",
"bin"
],

@@ -21,7 +23,10 @@ "dependencies": {

"author": "Titus Wormer <tituswormer@gmail.com>",
"bin": {
"dice-coefficient": "cli.js"
},
"devDependencies": {
"eslint": "^0.9.0",
"istanbul": "^0.3.0",
"jscs": "^1.7.0",
"matcha": "^0.5.0",
"jscs": "^1.0.0",
"matcha": "^0.6.0",
"mocha": "^2.0.0"

@@ -32,12 +37,13 @@ },

"test-travis": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --check-leaks -u exports test.js",
"lint": "npm run lint-api && npm run lint-test && npm run lint-style && npm run lint-benchmark",
"lint-api": "node_modules/.bin/eslint index.js --env node --env browser",
"lint-test": "node_modules/.bin/eslint test.js --env node --env mocha",
"lint-benchmark": "node_modules/.bin/eslint benchmark.js --env node --global suite,set,bench",
"lint-style": "node_modules/.bin/jscs index.js test.js benchmark.js --reporter=inline",
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -- test.js",
"benchmark": "node_modules/.bin/matcha benchmark.js",
"lint-api": "node_modules/.bin/eslint index.js",
"lint-cli": "node_modules/.bin/eslint cli.js",
"lint-test": "node_modules/.bin/eslint test.js --env mocha",
"lint-benchmark": "node_modules/.bin/eslint benchmark.js --global suite,set,bench",
"lint-style": "node_modules/.bin/jscs index.js cli.js test.js benchmark.js --reporter=inline",
"lint": "npm run lint-api && npm run lint-cli && npm run lint-test && npm run lint-style && npm run lint-benchmark",
"make": "npm run lint && npm run coverage",
"install-benchmark": "npm install natural",
"make": "npm run lint && npm run coverage"
"benchmark": "node_modules/.bin/matcha benchmark.js"
}
}

@@ -1,4 +0,4 @@

# dice-coefficient [![Build Status](https://travis-ci.org/wooorm/dice-coefficient.svg?branch=master)](https://travis-ci.org/wooorm/dice-coefficient) [![Coverage Status](https://img.shields.io/coveralls/wooorm/dice-coefficient.svg)](https://coveralls.io/r/wooorm/dice-coefficient?branch=master)
# dice-coefficient [![Build Status](https://img.shields.io/travis/wooorm/dice-coefficient.svg?style=flat)](https://travis-ci.org/wooorm/dice-coefficient) [![Coverage Status](https://img.shields.io/coveralls/wooorm/dice-coefficient.svg?style=flat)](https://coveralls.io/r/wooorm/dice-coefficient?branch=master)
The [Sørensen–Dice coefficient](http://en.wikipedia.org/wiki/Sørensen–Dice_coefficient) algorithm in JavaScript.
[Sørensen–Dice coefficient](http://en.wikipedia.org/wiki/Sørensen–Dice_coefficient). Real fast. No cruft.

@@ -35,23 +35,35 @@ ## Installation

## Other Dice-coefficient implementations
## Benchmark
- [NaturalNode/natural](https://github.com/NaturalNode/natural);
- [minuteman3/node-dice](https://github.com/minuteman3/node-dice) — Does not check bigrams, rather just unigrams. Thus producing different results (e.g., the difference between “nacht” and “night” according to node-dice is 0.6 rather than, [according to the formula](http://en.wikipedia.org/wiki/Dice%27s_coefficient#Formula), 0.25)
On a MacBook Air, it runs about 781,000 op/s, which is more than 7.5 times faster than natural.
## Benchmark
```
dice-coefficient
781 op/s » op/s * 1,000
Run the benchmark yourself:
natural
102 op/s » op/s * 1,000
```
## CLI
Install:
```sh
$ npm run benchmark
$ npm install dice-coefficient
```
On a MacBook Air, it runs about 725,000 op/s, which is more than 4 times faster than natural.
Usage:
```
dice-coefficient
774 op/s » op/s * 1,000
Usage: dice-coefficient <string> <string>
natural
99 op/s » op/s * 1,000
Options:
-h, --help output usage information
-v, --version output version number
Usage:
# output dice-coefficient
$ dice-coefficient night nacht
# 0.25
```

@@ -61,2 +73,2 @@

MIT © Titus Wormer
MIT © [Titus Wormer](http://wooorm.com)
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