Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var natural = require('natural'),
phonetic = natural.DoubleMetaphone;
var sentence = 'phonetic modules contain algorithms';
var stdin = process.openStdin();
stdin.setEncoding('ascii');
phonetic.attach();
process.stdout.write('enter a word that sounds like one of these, "' + sentence +'": ');
words = sentence.tokenizeAndPhoneticize();
function findMatch(input) {
inputSounds = input.phonetics();
console.log(inputSounds);
for(var i = 0; i < words.length; i++) {
wordSounds = words[i];
*/
var doubleMetaphone;
doubleMetaphone = require('./');
/*
* Optional dependencies.
*/
var natural,
doublemetaphone,
exception;
try {
natural = require('natural').DoubleMetaphone;
natural = natural.process.bind(natural);
} catch (error) {
exception = error;
}
try {
doublemetaphone = new (require('doublemetaphone'))();
doublemetaphone.setMaxCodeLen(Infinity);
doublemetaphone = doublemetaphone.doubleMetaphone.bind(doublemetaphone);
} catch (error) {
exception = error;
}
if (exception) {
console.log(
'\u001B[0;31m' +