Phonetic matching (sounds-like) matching can be done with the SoundEx, Metaphone or DoubleMetaphone algorithms

var natural = require('natural');
var metaphone = natural.Metaphone;
var soundEx = natural.SoundEx;

var wordA = 'phonetics';
var wordB = 'fonetix';

To test the two words to see if they sound alike:

if(, wordB))
    console.log('they sound alike!');

The raw phonetics are obtained with process():


A maximum code length can be supplied:

console.log(metaphone.process('phonetics', 3));

DoubleMetaphone deals with two encodings returned in an array. This feature is experimental and subject to change:

var natural = require('natural');
var dm = natural.DoubleMetaphone;

var encodings = dm.process('Matrix');

The raw phonetics are obtained with phonetics():


Full text strings can be tokenized into arrays of phonetics (much like how tokenization-to-arrays works for stemmers):

console.log('phonetics rock'.tokenizeAndPhoneticize());

Same module operations applied with SoundEx:

if(, wordB))
    console.log('they sound alike!');