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

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

const wordA = 'phonetics';
const 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:

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

const 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!');