🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

double-metaphone

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

double-metaphone - npm Package Compare versions

Comparing version

to
0.1.3

cli.js

30

package.json
{
"name": "double-metaphone",
"version": "0.1.2",
"description": "An implementation of the Double Metaphone algorithm by Lawrence Philips",
"version": "0.1.3",
"description": "Double Metaphone algorithm",
"license": "MIT",

@@ -10,3 +10,5 @@ "keywords": [

"double",
"metaphone"
"metaphone",
"cli",
"bin"
],

@@ -18,7 +20,10 @@ "repository": {

"author": "Titus Wormer <tituswormer@gmail.com>",
"bin": {
"double-metaphone": "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"

@@ -29,12 +34,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-benchmark && npm run lint-style",
"lint-api": "node_modules/.bin/eslint index.js --env node --env browser",
"lint-test": "node_modules/.bin/eslint test.js --env node --env mocha",
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -- test.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 --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",
"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-benchmark && npm run lint-style",
"make": "npm run lint && npm run coverage",
"install-benchmark": "npm install natural doublemetaphone",
"benchmark": "node_modules/.bin/matcha benchmark.js",
"make": "npm run lint && npm run coverage"
"benchmark": "node_modules/.bin/matcha benchmark.js"
}
}

63

Readme.md

@@ -1,11 +0,5 @@

# double-metaphone [![Build Status](https://travis-ci.org/wooorm/double-metaphone.svg?branch=master)](https://travis-ci.org/wooorm/double-metaphone) [![Coverage Status](https://img.shields.io/coveralls/wooorm/double-metaphone.svg)](https://coveralls.io/r/wooorm/double-metaphone?branch=master)
# double-metaphone [![Build Status](https://img.shields.io/travis/wooorm/double-metaphone.svg?style=flat)](https://travis-ci.org/wooorm/double-metaphone) [![Coverage Status](https://img.shields.io/coveralls/wooorm/double-metaphone.svg?style=flat)](https://coveralls.io/r/wooorm/double-metaphone?branch=master)
The [double metaphone](http://en.wikipedia.org/wiki/metaphone) algorithm in JavaScript, with some fixes and unreachable code removed. The code is 100% covered by more than 230 assertions(!).
[Double metaphone](http://en.wikipedia.org/wiki/metaphone) algorithm in JavaScript. Includes few fixes and dead-code removal. 100% coverage (which hasn’t been done before). No cruft. Real fast.
The major difference from the [original metaphone](https://github.com/wooorm/metaphone) algorithm is that the double metaphone is not limited to English only, thus also working on words from Germanic, Slavic, Spanish, Celtic, Greek, French, Italian, Chinese, or other origin.
Another difference is that the double metaphone algorithm returns two (hence “double”) possible phonetics: "Smith" yields "SM0" and "XMT", and "Schmidt" yields "XMT" and "SMT", thus making it possible to detect that they could be pronounced the same.
For even better results, combine it with a stemmer (e.g., my own porter stemmer [implementation](https://github.com/wooorm/stemmer)).
## Installation

@@ -44,4 +38,4 @@

```js
var doubleMetaphone = require('double-metaphone'),
stemmer = require('stemmer');
var doubleMetaphone = require('double-metaphone');
var stemmer = require('stemmer');

@@ -52,30 +46,45 @@ doubleMetaphone(stemmer("acceptingness")); // [ 'AKSPTNK', 'AKSPTNK' ]

## Other Double Metaphone implementations
## CLI
- [NaturalNode/natural](https://github.com/NaturalNode/natural) — Bit [buggy](https://github.com/NaturalNode/natural/issues/173);
- [hgoebl/doublemetaphone](https://github.com/hgoebl/doublemetaphone) — Constructors, more options;
- [Yomguithereal/clj-fuzzy](https://github.com/Yomguithereal/clj-fuzzy) — Clojure, bit slow.
Install:
```sh
$ npm install --global double-metaphone
```
## Benchmark
Run the benchmark yourself:
Use:
```
Usage: double-metaphone [options] string
```sh
$ npm run benchmark
Options:
-h, --help output usage information
-v, --version output version number
Usage:
Note! The two results are tab seperated!
# output phonetics of given value
$ double-metaphone michael
# MKL MXL
# output phonetics of stdin
$ echo "Xavier" | double-metaphone
# SF SFR
```
On a MacBook Air, it runs about 455,000 op/s.
## Benchmark
On a MacBook Air, it runs about 390,000 op/s.
```
double-metaphone — this module
455 op/s » op/s * 1,000
390 op/s » op/s * 1,000
doublemetaphone
424 op/s » op/s * 1,000
295 op/s » op/s * 1,000
natural
171 op/s » op/s * 1,000
clj-fuzzy
12 op/s » op/s * 1,000
140 op/s » op/s * 1,000
```

@@ -85,2 +94,2 @@

MIT © Titus Wormer
MIT © [Titus Wormer](http://wooorm.com)