Skip to content

macshonle/metaphone

 
 

Repository files navigation

metaphone Build Status Coverage Status

Metaphone algorithm in JavaScript. No cruft. Real fast.

Installation

npm:

npm install metaphone

metaphone is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

var metaphone = require('metaphone');

console.log(metaphone('hiccups')); // 'HKKPS'
console.log(metaphone('detestable')); // 'TTSTBL'
console.log(metaphone('vileness')); // 'FLNS'
console.log(metaphone('detestable') === metaphone('tetestble')); // true
var metaphone = require('metaphone');
var stemmer = require('stemmer');

console.log(metaphone(stemmer('hiccups'))); // HKKP
console.log(metaphone(stemmer('detestable'))); // TTST
console.log(metaphone(stemmer('vileness'))); // FL

console.log(metaphone(stemmer('detestable')) === metaphone(stemmer('tetest'))); // true

CLI

Install:

npm install --global metaphone

Use:

Usage: metaphone [options] <words...>

Fast Metaphone implementation

Options:

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

Usage:

# output phonetics
$ metaphone considerations detestable
# KNSTRXNS TTSTBL

# output phonetics from stdin
$ echo "hiccups vileness" | metaphone
# HKKPS FLNS

License

MIT © Titus Wormer

About

Fast Metaphone implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.7%
  • Shell 0.3%