metaphone
Metaphone algorithm in JavaScript. No cruft. Real fast.
Installation
npm:
$ npm install metaphone
Component:
$ component install wooorm/metaphone
Bower:
$ bower install metaphone
Usage
var metaphone = require('metaphone');
metaphone("hiccups");
metaphone("detestable");
metaphone("vileness");
metaphone("detestable") === metaphone("tetestble");
With stemmer:
var metaphone = require('metaphone');
var stemmer = require('stemmer');
metaphone(stemmer("hiccups"));
metaphone(stemmer("detestable"));
metaphone(stemmer("vileness"));
metaphone(stemmer("detestable")) === metaphone(stemmer("tetest"));
CLI
Install:
$ npm install --global metaphone
Use:
Usage: metaphone [options] string
Fast Metaphone implementation
Options:
-h, --help output usage information
-v, --version output version number
Usage:
# output phonetics of given value
$ metaphone detestable
# TTSTBL
# output phonetics from stdin
$ echo "vileness" | metaphone
# FLNS
Benchmark
On a MacBook Air, it runs about 136,000 op/s, which is a bit faster than natural.
metaphone — this module
136 op/s » op/s * 1,000
natural — more options
113 op/s » op/s * 1,000
Katee/metafone — pretty buggy
45 op/s » op/s * 1,000
License
MIT © Titus Wormer